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.
FIX add metadata routing to CV splitters in
RidgeCV
andRidgeClassifierCV
#29634New 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
FIX add metadata routing to CV splitters in
RidgeCV
andRidgeClassifierCV
#29634Changes from all commits
e3d4c1a
3956f2c
bc4804e
8125194
2c2db3d
336057a
feca19f
1b67c17
250b977
142e23c
72f4286
d5d3a1c
06cddaa
3ad1190
8ee822d
6c73dd2
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I should be missing something. Why we would not combine the above call in the same statement?
Or is it because we want still to set the score_request but in which case I would expect
I would probably add a small comment on the top to explain we do this procedure to avoid someone reverting to the first version.
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.
Thanks for looking into this. I am not sure if I understand what you mean, @glemaitre.
I will try to explain what I meant:
We have to call
self._get_scorer()
in any case (even ifscorer=None
, because in this case we need to use RidgeCV'sscore()
method viaPassthrougscorer
.So the code needs to be like this:
The scorer needs to be defined (
scorer = self._get_scorer()
) pretty early infit()
, because it is used inprocess_routing()
already if metadata routing is enabled and cv is None.But then below we need to reset
scorer
to None if the original user-inted was to not pass a scoring:If we would not do that, we would get an
AttributeError: '_IdentityRegressor' object has no attribute 'score'
because the scorer is already something else than None and we would pass something else than None into_RidgeGCV()
and we go down the wrong path of the code.Basically, we are misusing the variable
scorer
by having it have too many meanings at the same time. But maybe that's better than messing with the conventions?I have added a comment to explain what I mean. Does it all make sense?
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.
Yes completely. I missed that we were going to get the combination of
_PassthroughScorer
+_IdentityRegressor
that end-up in a non-compatible scikit-learn estimator.I think we can merge as-is. Maybe one clean-up could be to check that we get an
_Identity...
estimator that follow the scikit-learn API but I'm not sure that we can end-up with something working.