Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

ArturoAmorQ
Copy link
Member

@ArturoAmorQ ArturoAmorQ commented Jan 26, 2022

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 from sklearn.utils to validate the scalar parameter alphas and make sure to get consistent error types and messages in linear_model.LassoCV.

In the case that alphas is a list, a np.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.

@jjerphan jjerphan self-requested a review February 1, 2022 15:47
Copy link
Member

@jjerphan jjerphan left a 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?

Copy link
Member

@thomasjpfan thomasjpfan left a 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 !

@ArturoAmorQ
Copy link
Member Author

Thanks for your comments, @jjerphan and @thomasjpfan !

@thomasjpfan thomasjpfan changed the title MNT Add validation for parameter alphas in LassoCV MNT Add validation for parameter alphas in LassoCV Feb 26, 2022
@thomasjpfan thomasjpfan merged commit 34d39c7 into scikit-learn:main Feb 26, 2022
thomasjpfan added a commit to thomasjpfan/scikit-learn that referenced this pull request Mar 1, 2022
@ArturoAmorQ ArturoAmorQ deleted the validations_lassocv branch March 30, 2022 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants