8000 DOC impact of `tol` for solvers in RidgeClassifier (#25530) · scikit-learn/scikit-learn@b85bf9c · GitHub
[go: up one dir, main page]

Skip to content

Commit b85bf9c

Browse files
authored
DOC impact of tol for solvers in RidgeClassifier (#25530)
1 parent 54108d9 commit b85bf9c

File tree

1 file changed

+34
-4
lines changed

1 file changed

+34
-4
lines changed

sklearn/linear_model/_ridge.py

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -962,8 +962,23 @@ class Ridge(MultiOutputMixin, RegressorMixin, _BaseRidge):
962962
For 'lbfgs' solver, the default value is 15000.
963963
964964
tol : float, default=1e-4
965-
Precision of the solution. Note that `tol` has no effect for solvers 'svd' and
966-
'cholesky'.
965+
The precision of the solution (`coef_`) is determined by `tol` which
966+
specifies a different convergence criterion for each solver:
967+
968+
- 'svd': `tol` has no impact.
969+
970+
- 'cholesky': `tol` has no impact.
971+
972+
- 'sparse_cg': norm of residuals smaller than `tol`.
973+
974+
- 'lsqr': `tol` is set as atol and btol of scipy.sparse.linalg.lsqr,
975+
which control the norm of the residual vector in terms of the norms of
976+
matrix and coefficients.
977+
978+
- 'sag' and 'saga': relative change of coef smaller than `tol`.
979+
980+
- 'lbfgs': maximum of the absolute (projected) gradient=max|residuals|
981+
smaller than `tol`.
967982
968983
.. versionchanged:: 1.2
969984
Default value changed from 1e-3 to 1e-4 for consistency with other linear
@@ -1252,8 +1267,23 @@ class RidgeClassifier(_RidgeClassifierMixin, _BaseRidge):
12521267
The default value is determined by scipy.sparse.linalg.
12531268
12541269
tol : float, default=1e-4
1255-
Precision of the solution. Note that `tol` has no effect for solvers 'svd' and
1256-
'cholesky'.
1270+
The precision of the solution (`coef_`) is determined by `tol` which
1271+
specifies a different convergence criterion for each solver:
1272+
1273+
- 'svd': `tol` has no impact.
1274+
1275+
- 'cholesky': `tol` has no impact.
1276+
1277+
- 'sparse_cg': norm of residuals smaller than `tol`.
1278+
1279+
- 'lsqr': `tol` is set as atol and btol of scipy.sparse.linalg.lsqr,
1280+
which control the norm of the residual vector in terms of the norms of
1281+
matrix and coefficients.
1282+
1283+
- 'sag' and 'saga': relative change of coef smaller than `tol`.
1284+
1285+
- 'lbfgs': maximum of the absolute (projected) gradient=max|residuals|
1286+
smaller than `tol`.
12571287
12581288
.. versionchanged:: 1.2
12591289
Default value changed from 1e-3 to 1e-4 for consistency with other linear

0 commit comments

Comments
 (0)
0