-
-
Notifications
You must be signed in to change notification settings - Fork 26.3k
MNT Add validation for parameter alphas in LassoCV #22305
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
MNT Add validation for parameter alphas in LassoCV #22305
Conversation
…nto validations_lassocv
…nto validations_lassocv
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. Here are minor suggestions.
This remarks is out of the scope of this PR: to only perform validation once, might we want to split the current LassoCV.fit
into a (LassoCV.fit
, LassoCV._fit
) couple, where LassoCV.fit
would be the "front-end" performing the validation, and LassoCV._fit
would be called internally, potentially several times?
Co-authored-by: Julien Jerphanion <[email protected]>
…nto validations_lassocv
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.
Thank you for the PR @ArturoAmorQ !
Co-authored-by: Thomas J. Fan <[email protected]>
Co-authored-by: Thomas J. Fan <[email protected]>
Thanks for your comments, @jjerphan and @thomasjpfan ! |
LassoCV
Co-authored-by: Julien Jerphanion <[email protected]> Co-authored-by: Thomas J. Fan <[email protected]>
Reference Issues/PRs
Solves a part of the Issues #20724 and #21927. See also PR #21606.
What does this implement/fix? Explain your changes.
Use the helper function
check_scalar
fromsklearn.utils
to validate the scalar parameteralphas
and make sure to get consistent error types and messages inlinear_model.LassoCV
.In the case that
alphas
is a list, anp.ndarray
or a tuple, the check iterates through the elements and gives feedback on the position of the first parameter that fails the check.Any other comments?
This PR is a first approach to implement the validation for the scalar parameter alphas. Making the process more efficient when
fit
is called several times (large number of folds in the cv or large number of points in a grid search) will be addressed in a future PR.