Skip to content

Commit 0eba4d4

Browse files
MNT fix typo and internal documentation in LinearModelLoss and Newton solver (#32039)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
1 parent 2bcfd2e commit 0eba4d4

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

sklearn/linear_model/_glm/_newton_solver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ def inner_solve(self, X, y, sample_weight):
610610
# Instead, we resort to lbfgs.
611611
if self.verbose:
612612
print(
613-
" The inner solver stumbled upon an singular or ill-conditioned "
613+
" The inner solver stumbled upon a singular or ill-conditioned "
614614
"Hessian matrix and resorts to LBFGS instead."
615615
)
616616
self.use_fallback_lbfgs_solve = True

sklearn/linear_model/_linear_loss.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def sandwich_dot(X, W):
3131
)
3232
else:
3333
# np.einsum may use less memory but the following, using BLAS matrix
34-
# multiplication (gemm), is by far faster.
34+
# multiplication (GEMM), is by far faster.
3535
WX = W[:, None] * X
3636
return X.T @ WX
3737

@@ -71,7 +71,7 @@ class LinearModelLoss:
7171
if coef.shape (n_classes, n_dof):
7272
intercept = coef[:, -1]
7373
if coef.shape (n_classes * n_dof,)
74-
intercept = coef[n_features::n_dof] = coef[(n_dof-1)::n_dof]
74+
intercept = coef[n_classes * n_features:] = coef[(n_dof-1):]
7575
intercept.shape = (n_classes,)
7676
else:
7777
intercept = coef[-1]
@@ -85,7 +85,8 @@ class LinearModelLoss:
8585
else:
8686
hessian.shape = (n_dof, n_dof)
8787
88-
Note: If coef has shape (n_classes * n_dof,), the 2d-array can be reconstructed as
88+
Note: if coef has shape (n_classes * n_dof,), the classes are expected to be
89+
contiguous, i.e. the 2d-array can be reconstructed as
8990
9091
coef.reshape((n_classes, -1), order="F")
9192

0 commit comments

Comments
 (0)