Internally, the function uses the router’s MetadataRouter object (as
returned by a call to its get_metadata_routing method) to validate
per method that the routed metadata had been requested by the underlying
estimator, and extracts a mapping of the given metadata to the requested
metadata based on the routing information defined by the MetadataRouter.
Note that if routing is not enabled and kwargs is empty, then it
returns an empty routing where process_routing(...).ANYTHING.ANY_METHOD
is always an empty dictionary.
The output of this function is a Bunch that has a key for
each consuming object and those hold keys for their consuming methods, which then
contain keys for the metadata which should be routed to them. Consumers should
use item access (routed_params[child][method]) rather than attribute access,
so that the structure remains usable after crossing process boundaries (e.g.
joblib.Parallel with the dask backend), where serializers may downgrade
Bunch to plain dict.
An object implementing get_metadata_routing. Typically a
meta-estimator.
_method : str
The name of the router’s method in which this function is called.
**kwargs : dict
Metadata to be routed.
Returns:
routed_params : Bunch
A Bunch of the form {"object_name":{"method_name":{metadata:value}}} which can be used to pass the
required metadata to corresponding methods or corresponding child objects.
The object names are those defined in obj.get_metadata_routing().