- Notifications
You must be signed in to change notification settings - Fork25.8k
Description
Describe the issue linked to the documentation
TL;DR: Metadata routing for scoring could either use a base class or documentation of how to writeset_score_request()
.
Currently theMetadata Estimator Dev Guide has examples of a metadata-consuming estimator and a metadata-routing estimator. However, the metadata routing is also designed for scorers and CV splitters which may or may not be estimators. Fortunately,sklearn.model_selection
exposesBaseCrossValidator
, which likeBaseEstimator
, subclasses_MetadataRequester
. Unfortunately,there's no base class for scorers. the base class for scorers,_BaseScorer
, is not public.
I don't understand how to string together the relevant methods that should be a part ofset_score_params
, The current workaround is to simply subclassBaseEstimator
, even if I'm not making an estimator, or to subclass_MetadataRequester
, even though its not part of the public API.Or usemake_scorer
to pin the kwargs when instantiating the meta-estimator, rather than infit()
My use case is for scoring a time-series model where the data generating mechanism is known to the experiment, but not the model, and I need to compare the fit model to the true data generating mechanism. I understand how to use a custom scorer inRandomizedSearchCV
, and themetadata API explains how meta estimators likeRandomizedSearchCV
can pass additional arguments to my custom scorer.
Suggest a potential alternative/fix
- publicly exposing
_MetadataRequester
- publicly exposing
_BaseScorer
- Document how to write the
set_{method}_request()
methods. It looks like_MetadataRequester
uses a descriptorRequestMethod
, which relies on an instance having a_get_metadata_request
method and a_metadata_request
attribute (which it doesn't really describe).
EDIT: Found out about_BaseScorer
. Also, removedmake_scorer
workaround, as it doesn't result in passing the fitted estimator to the_score_func