sklearn.utils.metadata_routing.MethodMapping

class sklearn.utils.metadata_routing.MethodMapping[source]

Stores the mapping between caller and callee methods for a router.

This class is primarily used in a get_metadata_routing() of a router object when defining the mapping between a sub-object (a sub-estimator or a scorer) to the router’s methods. It stores a collection of namedtuples.

Iterating through an instance of this class will yield named MethodPair(caller, callee) tuples.

Added in version 1.3.

Methods

add(*, caller, callee)

Add a method mapping.

add(*, caller, callee)[source]

Add a method mapping.

Parameters:
callerstr

Parent estimator’s method name in which the callee is called.

calleestr

Child object’s method name. This method is called in caller.

Returns:
selfMethodMapping

Returns self.

Examples using sklearn.utils.metadata_routing.MethodMapping

Metadata Routing

Metadata Routing