8000 API prepare change of default solver QuantileRegressor by glemaitre · Pull Request #23637 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

API prepare change of default solver QuantileRegressor #23637

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

glemaitre
Copy link
Member

Related to #23626

"interior-point" solver will be removed from SciPy 1.11.
We need to introduce an "auto" mode to switch from one solver to another and announce a change of default.

@lorentzenchr
Copy link
Member

When will scipy 1.6 be our minimal scipy version?
If too late, this PR is the right thing, thanks @glemaitre.

@ogrisel
Copy link
Member
ogrisel commented Jun 16, 2022

https://scipy.org/news/#releases and in particular

  • SciPy 1.5.0 – 2020-06-21.
  • SciPy 1.6.0 – 2020-12-31.
  • SciPy 1.7.0 – 2021-06-20.
  • SciPy 1.8.0 – 2022-02-05.

From NEP29 which is a minimum requirement for scikit-learn:

When a project releases a new major or minor version, we recommend that they support at least all minor versions of Python introduced and released in the prior 42 months from the anticipated release date with a minimum of 2 minor versions of Python, and all minor versions of NumPy released in the prior 24 months from the anticipated release date with a minimum of 3 minor versions of NumPy.

scikit-learn 1.1.0 was released in 2022-05, so if we anticipate to release scikit-learn 1.2 in 2022-11, that means that we need to at least support 2022-11 - 24 == 2020-11 which includes SciPy 1.6 but not necessarily SciPy 1.5.

@ogrisel
Copy link
Member
ogrisel commented Jun 16, 2022

But we can safely anticipate that for scikit-learn 1.4 the scipy dependency will be at least 1.6 (more likely 1.7). So I think we can directly change this PR to skip the "auto" option and warn that in scikit-learn 1.4 solver="highs" by default.

@glemaitre
Copy link
Member Author

Works for me. I will update this PR.

ogrisel reacted with thumbs up emoji

@@ -120,7 +126,7 @@ def test_quantile_estimates_calibration(q):
quant = QuantileRegressor(
quantile=q,
alpha=0,
solver_options={"lstsq": False},
solver="highs",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tests breaks on old scipy versions (<1.6.0) that we still support for now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are other tests to be updated similarly. We could probably have a help to chose the solver to use in the test based on the installed version of scipy.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a small fixture to get the default value to use depending of the version.

@glemaitre glemaitre changed the title FIX add 'auto' solver in QuantileRegressor API add 'auto' solver in QuantileRegressor Jun 16, 2022
Copy link
Member
@lorentzenchr lorentzenchr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@glemaitre glemaitre changed the title API add 'auto' solver in QuantileRegressor API change default solver to "highs" in QuantileRegressor Jun 21, 2022
Copy link
Member
@lesteve lesteve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM one comment on top of the one @lorentzenchr had.

Copy link
Member
@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Should update update the example examples/linear_model/plot_quantile_regression.py to avoid raising the warning?

Since we need to run on the oldest supported scipy we might need to do the same ternary operation:

solver = "highs" if sp_version >= parse_version("1.6.0") else "interior-point"

in the example itself. But maybe we can just live with the warning. As you prefer.

glemaitre and others added 2 commits June 24, 2022 11:32
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
@glemaitre
Copy link
Member Author

I think this is nicer to not have the warning. I add the if/else condition with a short explanation for our reader advising to use "highs" if their SciPy version allows.

@lesteve lesteve changed the title API change default solver to "highs" in QuantileRegressor API prepare change of default solver QuantileRegressor Jun 24, 2022
@lesteve lesteve merged commit a7e27da into scikit-learn:main Jun 24, 2022
ogrisel added a commit to ogrisel/scikit-learn that referenced this pull request Jul 11, 2022
…23637)

Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0