-
-
Notifications
You must be signed in to change notification settings - Fork 26.5k
FIX Sample weight in BayesianRidge #30644
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 Sample weight in BayesianRidge #30644
Conversation
|
Thanks for the PR. It is marked draft, but I have the feeling it's ready for review. Is there anything left to do before reviewing? |
ogrisel
left a comment
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.
Quick comment from a first glance at the diff:
sklearn/linear_model/_bayes.py
Outdated
| ) | ||
|
|
||
| rmse_ = np.sum((y - np.dot(X, coef_)) ** 2) | ||
| mse_ = np.sum((y - np.dot(X, coef_)) ** 2) |
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.
Don't we need to compute the weighted mse here as well?
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.
It's computing the weighted mse because the X and y are scaled by sample_weight in _rescale_data
I think it's now ready for review. |
ogrisel
left a comment
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.
A few more suggestions but otherwise LGTM!
Co-authored-by: Olivier Grisel <[email protected]>
OmarManzoor
left a comment
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 @antoinebaker
Reference Issues/PRs
Part of meta issue #16298
What does this implement/fix? Explain your changes.
Some of the code in
BayesianRidgedid not handlesample_weightproperly, in particular the initialization and update for thealpha_hyperparameter. NowBayesianRidgepasses thecheck_sample_weight_equivalencetest.Any other comments?
Renaming
rmse -> sseas it is actually the sum of squared errors.