-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Add sample_weight to the calculation of alphas in enet_path and LinearModelCV #23045
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
Conversation
It seems like this single call to _preprocess_data suffices in all cases.
This tiny example was given in #22914. The test merely asserts that alpha_max is large enough to force the coefficient to 0.
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 first round of review comments.
As per reviewer's suggestions: (1) Clarify eps=1. (2) Parameterize `fit_intercept`.
(1) Give the name `n_samples` to the quantity `X.shape[0]`. (2) Clarify that `y_offset` and `X_scale` are not used, since these are already applied to the data by `_preprocess_data`.
@TomDLT May I kindly ping you as your help would be much appreciated. |
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.
Looks good, although I did not check the math.
Main remark: The new test function tests that the computed alpha_max
is larger or equal to the true alpha_max
. To test that they are actually equal, we could test that alpha_max * 0.99
does not return all-zero coefficients.
We could also add a test that the computation still works without sample weights.
I have attempted to update the test according to your recommendation.
My feeling is that |
The main thing I'm confused about, is why it's even possible for |
I don't think it guarantees that the
It seems weird indeed. It seems that |
Per your suggestion, I parameterized the new test by I know my opinion on this matter isn't very valuable, but I'll share anyway. |
I agree it makes more sense to compute the alpha grid within the path function. We would need to have We might still need to have |
We won't have time to review this one before the 1.2 release. Moving it to 1.3 |
(didn't mean to close :/ ) |
Reference Issues/PRs
Fixes #22914.
What does this implement/fix? Explain your changes.
Modifies
_alpha_grid
function inlinear_model._coordinate_descent
to accept asample_weight
argument.The function
_alpha_grid
is called in two places,enet_path
andLinearModelCV
.The new
sample_weight
argument is not used byenet_path
, but it is used byLinearModelCV
.Any other comments?
Since my previous PR on this issue,
_preprocess_data
has been rewritten.