Skip to content

Commit

Permalink
revert autoformatter changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mathurinm committed Nov 7, 2024
1 parent cdc7768 commit bd3a02f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
3 changes: 1 addition & 2 deletions skglm/datafits/single_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,7 @@ def gradient_scalar(self, X, y, w, Xw, j):
def gradient_scalar_sparse(self, X_data, X_indptr, X_indices, y, Xw, j):
XjTXw = 0.
for i in range(X_indptr[j], X_indptr[j + 1]):
XjTXw += X_data[i] * \
self.sample_weights[X_indices[i]] * Xw[X_indices[i]]
XjTXw += X_data[i] * self.sample_weights[X_indices[i]] * Xw[X_indices[i]]
return (XjTXw - self.Xty[j]) / self.sample_weights.sum()

def gradient(self, X, y, Xw):
Expand Down
12 changes: 4 additions & 8 deletions skglm/estimators.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,8 +601,7 @@ def fit(self, X, y):
Fitted estimator.
"""
if self.weights is None:
warnings.warn(
'Weights are not provided, fitting with Lasso penalty')
warnings.warn('Weights are not provided, fitting with Lasso penalty')
penalty = L1(self.alpha, self.positive)
else:
penalty = WeightedL1(self.alpha, self.weights, self.positive)
Expand Down Expand Up @@ -735,8 +734,7 @@ def path(self, X, y, alphas, coef_init=None, return_n_iter=True, **params):
The number of iterations along the path. If return_n_iter is set to
``True``.
"""
penalty = compiled_clone(L1_plus_L2(
self.alpha, self.l1_ratio, self.positive))
penalty = compiled_clone(L1_plus_L2(self.alpha, self.l1_ratio, self.positive))
datafit = compiled_clone(Quadratic(), to_float32=X.dtype == np.float32)
solver = AndersonCD(
self.max_iter, self.max_epochs, self.p0, tol=self.tol,
Expand Down Expand Up @@ -1324,8 +1322,7 @@ def fit(self, X, y):
f"two columns. Got one column.\nAssuming that `y` "
"is the vector of times and there is no censoring."
)
y = np.column_stack((y, np.ones_like(y))).astype(
X.dtype, order="F")
y = np.column_stack((y, np.ones_like(y))).astype(X.dtype, order="F")
elif y.shape[1] > 2:
raise ValueError(
f"{repr(self)} requires the vector of response `y` to have "
Expand Down Expand Up @@ -1543,8 +1540,7 @@ def path(self, X, Y, alphas, coef_init=None, return_n_iter=False, **params):
The number of iterations along the path. If return_n_iter is set to
``True``.
"""
datafit = compiled_clone(QuadraticMultiTask(),
to_float32=X.dtype == np.float32)
datafit = compiled_clone(QuadraticMultiTask(), to_float32=X.dtype == np.float32)
penalty = compiled_clone(L2_1(self.alpha))
solver = MultiTaskBCD(
self.max_iter, self.max_epochs, self.p0, tol=self.tol,
Expand Down

0 comments on commit bd3a02f

Please sign in to comment.