Skip to content

Commit b0a5ee5

Browse files
lestevepunndcoder28
authored andcommitted
MNT clean up old scipy sparse.linalg.cg fallback code (scikit-learn#26813)
1 parent 216d96b commit b0a5ee5

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

sklearn/linear_model/_ridge.py

+4-14
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,7 @@ def _mv(x):
105105
C = sp_linalg.LinearOperator(
106106
(n_samples, n_samples), matvec=mv, dtype=X.dtype
107107
)
108-
# FIXME atol
109-
try:
110-
coef, info = sp_linalg.cg(C, y_column, tol=tol, atol="legacy")
111-
except TypeError:
112-
# old scipy
113-
coef, info = sp_linalg.cg(C, y_column, tol=tol)
108+
coef, info = sp_linalg.cg(C, y_column, tol=tol, atol="legacy")
114109
coefs[i] = X1.rmatvec(coef)
115110
else:
116111
# linear ridge
@@ -119,14 +114,9 @@ def _mv(x):
119114
C = sp_linalg.LinearOperator(
120115
(n_features, n_features), matvec=mv, dtype=X.dtype
121116
)
122-
# FIXME atol
123-
try:
124-
coefs[i], info = sp_linalg.cg(
125-
C, y_column, maxiter=max_iter, tol=tol, atol="legacy"
126-
)
127-
except TypeError:
128-
# old scipy
129-
coefs[i], info = sp_linalg.cg(C, y_column, maxiter=max_iter, tol=tol)
117+
coefs[i], info = sp_linalg.cg(
118+
C, y_column, maxiter=max_iter, tol=tol, atol="legacy"
119+
)
130120

131121
if info < 0:
132122
raise ValueError("Failed with error code %d" % info)

0 commit comments

Comments
 (0)