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.
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.
Don't we need to compute the weighted mse here as well?
There was a problem hiding this comment.
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.
A few more suggestions but otherwise LGTM!
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
OmarManzoor
left a comment
There was a problem hiding this comment.
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.