10000 ENH `LinearRegression` Optimizations by jjerphan · Pull Request #22940 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

ENH LinearRegression Optimizations #22940

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

Closed
wants to merge 18 commits into from

Conversation

jjerphan
Copy link
Member
@jjerphan jjerphan commented Mar 24, 2022

Reference Issues/PRs

Fixes #14268.
Fixes #22855.

Supersedes #17560

What does this implement/fix? Explain your changes.

Taken from #17560:

  • Changes scipy.linalg.lstsq call in the fit function in LinearRegression to include the check_finite=False flag. This is because a finiteness check is already completed in the data validation step. fit calls self._preprocess_data, which itself calls check_array, which is defined in utils/validation.py. check_array has a force_all_finite flag. The scipy.linalg.lstsq documentation can be found here.
  • Factors out Ridge code into _ridge_solvers.py so Ridge(solver = "cholesky", alpha = 0) can be used in LinearRegression without explicitly calling the Ridge estimator.
  • Enables optional solver parameter in LinearRegression, which if set to "cholesky" uses Cholesky Ridge method with alpha=0 for OLS fit.
  • Documentation and tests.

Any other comments?

TODO:

Author:    Rithvik Rao <rithvik321@gmail.com>
…for linear regression

Author:    Rithvik Rao <rithvik321@gmail.com>
…finite X

Author:    Rithvik Rao <rithvik321@gmail.com>
Author:    Rithvik Rao <rithvik321@gmail.com>
Author:    Rithvik Rao <rithvik321@gmail.com>
Author:    Rithvik Rao <rithvik321@gmail.com>
Author:    Rithvik Rao <rithvik321@gmail.com>
Author:    Rithvik Rao <rithvik321@gmail.com>
Author:    Rithvik Rao <rithvik321@gmail.com>
Author:    Rithvik Rao <rithvik321@gmail.com>
Author:    Rithvik Rao <rithvik321@gmail.com>
Author:    Rithvik Rao <rithvik321@gmail.com>
@jjerphan jjerphan force-pushed the linear-regression-solvers branch from 9bebad0 to e5ca2c0 Compare March 25, 2022 17:09
@lorentzenchr
Copy link
Member

@jjerphan I think this old PR does much too much refactoring.
I see 2 options:

  • Make LinearRegression a subclass of Ridge which sets alpha=0 and has one additional solver lstsq.
  • Call _ridge_regression for new solvers. It seems to do all the input checking, but no centering.

@jjerphan
Copy link
Member Author
jjerphan commented Dec 2, 2022

Closing this PR to restart this work from scratch one day.

@jjerphan jjerphan closed this Dec 2, 2022
@jjerphan jjerphan deleted the linear-regression-solvers branch January 12, 2023 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
0