-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Fix LinearRegression
's numerical stability on rank deficient data by setting the cond
parameter in the call to scipy.linalg.lstsq
#30040
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
thomasjpfan
merged 13 commits into
scikit-learn:main
from
antoinebaker:linear_regression_sample_weight_bug_scipy
Oct 24, 2024
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
3d28963
use cond parameter [all random seeds]
antoinebaker 29283f3
fix docstring [ci skip]
antoinebaker 0b291ae
changelog [all random seeds]
antoinebaker 2118873
using resolution [all random seeds]
antoinebaker ff1d45f
Merge branch 'main' into linear_regression_sample_weight_bug_scipy
antoinebaker 1f04e22
remove xfail tags
antoinebaker c211945
more tests
antoinebaker ba3833f
numpy default for cond
antoinebaker 0ba0af6
Merge remote-tracking branch 'upstream/main' into linear_regression_s…
antoinebaker d0d9500
xfail csr tests
antoinebaker 47aea9d
changelog
antoinebaker 607795f
trigger CI [all random seeds]
antoinebaker 414a8a3
Update doc/whats_new/upcoming_changes/sklearn.linear_model/30040.fix.rst
antoinebaker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
doc/whats_new/upcoming_changes/sklearn.linear_model/30040.fix.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
- :class:`linear_model.LinearRegression` now sets the `cond` parameter when | ||
calling the `scipy.linalg.lstsq` solver on dense input data. This ensures | ||
more numerically robust results on rank-deficient data. In particular, it | ||
empirically fixes the expected equivalence property between fitting with | ||
reweighted or with repeated data points. | ||
:pr:`30040` by :user:`Antoine Baker <antoinebaker>`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fact we can remove this while there is still a problem with sparse inputs makes me realize that we should expand
check_sample_weight_equivalence
to also test fitting with sparse inputs (when the estimator accepts sparse inputs). Let's open a dedicated PR for this (e.g. by introducing a new check namedcheck_sample_weight_equivalence_on_sparse_data
).