FEAT add metadata routing to *SearchCV#27058
Conversation
|
cc @glemaitre @thomasjpfan @OmarManzoor , this is ready for review. Note: I removed routing for non fit/score methods here (26a98f7) since to do that properly we need to make sure |
OmarManzoor
left a comment
There was a problem hiding this comment.
Thanks @adrinjalali ! I think this looks good. Just a few minor comments.
OmarManzoor
left a comment
There was a problem hiding this comment.
LGTM. Thanks @adrinjalali
|
Sorry my bad, I misread my mail :). I have to review now ;). |
| best_index = results[f"rank_test_{refit_metric}"].argmin() | ||
| return best_index | ||
|
|
||
| def _get_scorers(self, convert_multimetric): |
There was a problem hiding this comment.
I think that we should refactor this method at some point because it will be part of all metaestimators having a CV.
| - preserves_metadata: | ||
| - True (default): the metaestimator passes the metadata to the | ||
| sub-estimator without modification. We check that the values recorded by | ||
| the sub-estimator are identical to what we've passed to the | ||
| metaestimator. | ||
| - False: no check is performed regarding values, we only check that a | ||
| metadata with the expected names/keys are passed. | ||
| - "subset": we check that the recorded metadata by the sub-estimator is a | ||
| subset of what is passed to the metaestimator. |
There was a problem hiding this comment.
Can you please explain, @adrinjalali ? In which case would we test each case?
There was a problem hiding this comment.
for instance, GridSearchCV can take sample_weight, but select a subset of that and pass it to the sub-estimator. Other meta-estimators would forward the metadata as is.
There was a problem hiding this comment.
I have seen that GridSearchCV is checked for passing a subset of the metadata to sub-estimators. My assumption is, because it uses an internal splitter? But why then is LogisticRegressionCV checked for the whole metadata to be passed (it also splits the data)?
My apologies, but I need more guidance here.
There was a problem hiding this comment.
This parameter only applies to what's sent to the sub-estimator in the tests. LogisticRegressionCV doesn't have a sub-estimator set by the user, so this parameter is irrelevant.
Add metadata routing to
*SearchCVTowards #22893
Fixes #8127
Fixes #8158