8000 MAINT change the default solver in QuantileRegressor (#27943) · punndcoder28/scikit-learn@e430f6e · GitHub
[go: up one dir, main page]

Skip to content

Commit e430f6e

Browse files
authored
MAINT change the default solver in QuantileRegressor (scikit-learn#27943)
1 parent e8ec36c commit e430f6e

File tree

3 files changed

+6
-30
lines changed

3 files changed

+6
-30
lines changed

sklearn/decomposition/tests/test_sparse_pca.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def test_spca_feature_names_out(SPCA):
268268
assert_array_equal([f"{estimator_name}{i}" for i in range(4)], names)
269269

270270

271-
# TODO (1.6): remove in 1.6
271+
# TODO(1.6): remove in 1.6
272272
def test_spca_max_iter_None_deprecation():
273273
"""Check that we raise a warning for the deprecation of `max_iter=None`."""
274274
rng = np.random.RandomState(0)

sklearn/linear_model/_quantile.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from ..base import BaseEstimator, RegressorMixin, _fit_context
1212
from ..exceptions import ConvergenceWarning
1313
from ..utils import _safe_indexing
14-
from ..utils._param_validation import Hidden, Interval, StrOptions
14+
from ..utils._param_validation import Interval, StrOptions
1515
from ..utils.fixes import parse_version, sp_version
1616
from ..utils.validation import _check_sample_weight
1717
from ._base import LinearModel
@@ -44,7 +44,7 @@ class QuantileRegressor(LinearModel, RegressorMixin, BaseEstimator):
4444
Whether or not to fit the intercept.
4545
4646
solver : {'highs-ds', 'highs-ipm', 'highs', 'interior-point', \
47-
'revised simplex'}, default='interior-point'
47+
'revised simplex'}, default='highs'
4848
Method used by :func:`scipy.optimize.linprog` to solve the linear
4949
programming formulation.
5050
@@ -55,7 +55,7 @@ class QuantileRegressor(LinearModel, RegressorMixin, BaseEstimator):
5555
From `scipy>=1.11.0`, "interior-point" is not available anymore.
5656
5757
.. versionchanged:: 1.4
58-
The default of `solver` will change to `"highs"` in version 1.4.
58+
The default of `solver` changed to `"highs"` in version 1.4.
5959
6060
solver_options : dict, default=None
6161
Additional parameters passed to :func:`scipy.optimize.linprog` as
@@ -121,7 +121,6 @@ class QuantileRegressor(LinearModel, RegressorMixin, BaseEstimator):
121121
"revised simplex",
122122
}
123123
),
124-
Hidden(StrOptions({"warn"})),
125124
],
126125
"solver_options": [dict, None],
127126
}
@@ -132,7 +131,7 @@ def __init__(
132131
quantile=0.5,
133132
alpha=1.0,
134133
fit_intercept=True,
135-
solver="warn",
134+
solver="highs",
136135
solver_options=None,
137136
):
138137
self.quantile = quantile
@@ -182,17 +181,7 @@ def fit(self, X, y, sample_weight=None):
182181
# So we rescale the penalty term, which is equivalent.
183182
alpha = np.sum(sample_weight) * self.alpha
184183

185-
if self.solver == "warn":
186-
warnings.warn(
187-
(
188-
"The default solver will change from 'interior-point' to 'highs' in"
189-
" version 1.4. Set `solver='highs'` or to the desired solver to"
190-
" silence this warning."
191-
),
192-
FutureWarning,
193-
)
194-
solver = "interior-point"
195-
elif self.solver in (
184+
if self.solver in (
196185
"highs-ds",
197186
"highs-ipm",
198187
"highs",

sklearn/linear_model/tests/test_quantile.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -292,19 +292,6 @@ def test_sparse_input(sparse_container, solver, fit_intercept, default_solver):
292292
assert 0.45 <= np.mean(y < quant_sparse.predict(X_sparse)) <= 0.57
293293

294294

295-
# TODO (1.4): remove this test in 1.4
296-
@pytest.mark.skipif(
297-
parse_version(sp_version.base_version) >= parse_version("1.11"),
298-
reason="interior-point solver is not available in SciPy 1.11",
299-
)
300-
def test_warning_new_default(X_y_data):
301-
"""Check that we warn about the new default solver."""
302-
X, y = X_y_data
303-
model = QuantileRegressor()
304-
with pytest.warns(FutureWarning, match="The default solver will change"):
305-
model.fit(X, y)
306-
307-
308295
def test_error_interior_point_future(X_y_data, monkeypatch):
309296
"""Check that we will raise a proper error when requesting
310297
`solver='interior-point'` in SciPy >= 1.11.

0 commit comments

Comments
 (0)
0