-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
FIX Covariance matrix in BayesianRidge #31094
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
FIX Covariance matrix in BayesianRidge #31094
Conversation
The failing tests on the Linux debian_32bit seem unrelated to this PR, so I think it is ready for review. FAILED tests/test_common.py::test_estimators[LinearRegression(positive=True)-check_sample_weight_equivalence_on_dense_data] - AssertionError:
FAILED utils/tests/test_estimator_checks.py::test_check_estimator_clones - AssertionError: |
I opened #31098 for the CI failure. |
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.
LGTM.
doc/whats_new/upcoming_changes/sklearn.linear_model/31094.fix.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
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.
LGTM. Thanks !
test_bayesian_covariance_matrix
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org> Co-authored-by: Jérémie du Boisberranger <jeremie@probabl.ai>
Fixes #31093
What does this implement/fix? Explain your changes.
Using the reduced SVD leads to an incorrect covariance matrix when
n_samples < n_features
.This PR uses the full SVD to compute the posterior covariance matrix when
n_samples < n_features
, and keeps the reduced SVD whenn_samples > n_features
for performance in the largen_samples
case.The non-regression test
test_bayesian_covariance_matrix
is added.