DOC: Note alpha_per_target incompatibility with cv in RidgeCV#33819
Merged
GaelVaroquaux merged 1 commit intoscikit-learn:mainfrom Apr 28, 2026
Merged
Conversation
alpha_per_target=True raises ValueError when cv is not None, but the docstring did not mention this. Add the same note already used by store_cv_results. Made-with: Cursor
AnneBeyer
approved these changes
Apr 21, 2026
Contributor
AnneBeyer
left a comment
There was a problem hiding this comment.
Thank you @shouhamdi for spotting this. LGTM!
Abdeltoto
approved these changes
Apr 26, 2026
Abdeltoto
left a comment
There was a problem hiding this comment.
Thanks, this looks correct to me. I checked that the added note matches the existing \ValueError\ path for \�lpha_per_target=True\ with \cv is not None, and it is consistent with the neighboring \store_cv_results\ documentation.
Member
GaelVaroquaux
left a comment
There was a problem hiding this comment.
LGTM.
Thanks a lot @shouhamdi for the PR, and @AnneBeyer and @Abdeltoto for the reviews.
Merging, as such a DOC PR needs only one core-dev review
GaelVaroquaux
approved these changes
Apr 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
alpha_per_targetparameter ofRidgeCVraises aValueErrorwhenused together with
cv != None, but the docstring does not mention thisrestriction. This PR adds the same one-line note already present on the
sibling parameter
store_cv_results:Evidence
_BaseRidgeCV.fit():test_ridge.py(test_ridge_gcv_vs_ridge_loo_cv) confirmsthis
ValueErroris expected for bothcv=LeaveOneOut()andcv=6.store_cv_resultsalready documents an identicalconstraint — this PR brings
alpha_per_targetin line.Change
Two lines added to the
alpha_per_targetdocstring inRidgeCV(
sklearn/linear_model/_ridge.py). No code or test changes.Made with @tomMoral and @kingjr