MethodMapping
- classsklearn.utils.metadata_routing.MethodMapping[source]
-
Stores the mapping between
callerandcalleemethods for a router.This class is primarily used in a
get_metadata_routing()of a router object when defining the mapping between the router’s methods and a sub-object (a sub-estimator or a scorer).Iterating through an instance of this class yields
MethodPair(caller, callee)instances.Read more on developing custom estimators that can route metadata in the Metadata Routing Developing Guide.
Added in version 1.3.
Examples
>>> from sklearn.utils.metadata_routing import MethodMapping >>> MethodMapping().add(caller="fit", callee="split") [{'caller': 'fit', 'callee': 'split'}]- add(*, caller, callee)[source]
-
Add a method mapping.
- Parameters:
-
- callerstr
-
Parent estimator’s method name in which the
calleeis called. - calleestr
-
Child object’s method name. This method is called in
caller.
- Returns:
-
- selfMethodMapping
-
Returns self.
Gallery examples
© 2007–2026 The scikit-learn developers
Licensed under the 3-clause BSD License.
https://scikit-learn.org/1.9/modules/generated/sklearn.utils.metadata_routing.MethodMapping.html