You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pipeline score asks to explicitly request sample_weight #30937
When using Pipeline with metadata routing enabled, an error is thrown unless we explicitly request sample_weight for the score method (see example below). But Pipeline is just a router (for both the fit and score methods) and not a consumer of sample_weight, so in principle it should not require sample_weight to be explicitly requested.
No error is thrown, and sample_weight are routed to the logreg.
Actual Results
sklearn.exceptions.UnsetMetadataPassedError: [sample_weight] are passed but are not explicitly set as requested or not requested for Pipeline.score, which is used within GridSearchCV.fit. Call `Pipeline.set_score_request({metadata}=True/False)` for each metadata you want to request/ignore.
I'll see how one can reliably extract a part of a larger request here. I remember having a simple copy of the whole thing wouldn't solve the issue, not sure why.
Activity
ogrisel commentedon Mar 4, 2025
cc @StefanieSenger @adrinjalali
adrinjalali commentedon Mar 4, 2025
I think the solution should be very similar to
LogisticRegressionCV: #30859guilhermecsnpeixoto commentedon Mar 6, 2025
pedroL0pes commentedon Mar 6, 2025
adrinjalali commentedon Mar 7, 2025
pedroL0pes commentedon Mar 7, 2025
adrinjalali commentedon Aug 7, 2025
Digging deeper here, the issue seems to be that
_PassthroughScorerdoesn't correctly manage to extract thescorerequests on a meta-estimator:scikit-learn/sklearn/metrics/_scorer.py
Lines 481 to 493 in 52fb066
I'll see how one can reliably extract a part of a larger request here. I remember having a simple copy of the whole thing wouldn't solve the issue, not sure why.
PaulOberg1 commentedon Aug 11, 2025