Repository navigation
FIX Metadata Routing tests and record_metadata - #34179
Conversation
| @@ -407,10 +407,9 @@ def test_nested_routing(): | |||
|
|
|||
| pipeline.predict(X, sample_weight=w3) | |||
There was a problem hiding this comment.
Most probably, the intend was to test innermost_estimator.predict below here. So I fixed this to test that.
| - :class:`ensemble.BaggingClassifier` now correctly routes metadata via `predict` and | ||
| `predict_proba` dynamically to the corresponding method on the sub-estimator. | ||
| By :user:`Stefanie Senger <StefanieSenger>`. |
There was a problem hiding this comment.
This refers to PR #34188, where I had forgotten the changelog.
| "preserves_metadata": "subset", | ||
| "scorer_name": "scoring", | ||
| "scorer_routing_methods": ["fit", "score"], | ||
| "scorer_routing_methods": ["fit"], |
There was a problem hiding this comment.
TunedThresholdClassifierCV doesn't route via score.
|
This is now ready for review. :) @adrinjalali, @OmarManzoor, maybe you want to have a look? |
adrinjalali
left a comment
There was a problem hiding this comment.
With the help of Claude, here are a few notes which I think are pretty valid.
Co-authored-by: Adrin Jalali <[email protected]>
…t-learn into fix_record_metadata
| # clear module-level consuming_metric._records (ConsumingScorer) each iteration | ||
| if hasattr(consuming_metric, "_records"): | ||
| consuming_metric._records.clear() |
There was a problem hiding this comment.
didn't we get rid of the module level records?
There was a problem hiding this comment.
Yea we did. I just forgot the remove them. They're gone now.
| # clear module-level consuming_metric._records (ConsumingScorer) each iteration | ||
| if hasattr(consuming_metric, "_records"): | ||
| consuming_metric._records.clear() |
| # clear module-level consuming_metric._records (ConsumingScorer) each iteration | ||
| if hasattr(consuming_metric, "_records"): | ||
| consuming_metric._records.clear() | ||
|
|
OmarManzoor
left a comment
There was a problem hiding this comment.
LGTM. Thank you @StefanieSenger
Co-authored-by: Omar Salman <[email protected]>
|
Happy to merge, could you just validate the codecov warnings and check if we should explicitly ignore them, or add a test? |
adrinjalali
left a comment
There was a problem hiding this comment.
we have both, but a lot more of no cover and I find it nicer 😅
Co-authored-by: Adrin Jalali <[email protected]>
Co-authored-by: Adrin Jalali <[email protected]>
Co-authored-by: Adrin Jalali <[email protected]> Co-authored-by: Omar Salman <[email protected]>
Co-authored-by: Adrin Jalali <[email protected]> Co-authored-by: Omar Salman <[email protected]>
Reference Issues/PRs
superseding #33285 (see comment#r3333755620)
What does this implement/fix? Explain your changes.
A central facility of the common metadata tests was broken (we had accidentally compared if an empty list is part of an expected list).
This PR fixes
recordsis not empty incheck_recorded_metadata; since now a bunch of the tests failed this PR further fixes:record_metadatawhich had derived the names of thecallerandcalleefunctions too statically. It now takes an educated guess and only uses positional function names as a fallbackif not preserves_metadata: continue)_get_callee_from_callerhelper function based on router for testsfilter_registryfor metaestimators that do not use every fitted ConsumingEstimtator in also predict and score_recordsofconsuming_metricbetween test runsThis PR also adds
__repr__for_Registryclass for debugging convenience.AI usage disclosure
I used AI assistance for: