33
33
)
34
34
from ..utils ._param_validation import Interval , StrOptions
35
35
from ..utils .extmath import row_norms , safe_sparse_dot
36
+ from ..utils .fixes import _sparse_linalg_cg
36
37
from ..utils .sparsefuncs import mean_variance_axis
37
38
from ..utils .validation import _check_sample_weight , check_is_fitted
38
39
from ._base import LinearClassifierMixin , LinearModel , _preprocess_data , _rescale_data
@@ -105,7 +106,7 @@ def _mv(x):
105
106
C = sp_linalg .LinearOperator (
106
107
(n_samples , n_samples ), matvec = mv , dtype = X .dtype
107
108
)
108
- coef , info = sp_linalg . cg (C , y_column , tol = tol , atol = "legacy" )
109
+ coef , info = _sparse_linalg_cg (C , y_column , rtol = tol )
109
110
coefs [i ] = X1 .rmatvec (coef )
110
111
else :
111
112
# linear ridge
@@ -114,9 +115,7 @@ def _mv(x):
114
115
C = sp_linalg .LinearOperator (
115
116
(n_features , n_features ), matvec = mv , dtype = X .dtype
116
117
)
117
- coefs [i ], info = sp_linalg .cg (
118
- C , y_column , maxiter = max_iter , tol = tol , atol = "legacy"
119
- )
118
+ coefs [i ], info = _sparse_linalg_cg (C , y_column , maxiter = max_iter , rtol = tol )
120
119
121
120
if info < 0 :
122
121
raise ValueError ("Failed with error code %d" % info )
0 commit comments