Toggle Menu
Prev Up Next

scikit-learn 1.3.2
Other versions

Please cite us if you use the software.

# `sklearn.utils.metadata_routing`.process_routing

sklearn.utils.metadata_routing.process_routing(obj, method, other_params, **kwargs)

  Validate and route input parameters.

  This function is used inside a router’s method, e.g. fit, to validate the metadata and handle the routing.

  Assuming this signature: `fit(self, X, y, sample_weight=None, **fit_params)`, a call to this function would be: `process_routing(self, fit_params, sample_weight=sample_weight)`.

  New in version 1.3.

  Parameters:
    obj object

      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.

    other_params dict

      A dictionary of extra parameters passed to the router’s method, e.g. `**fit_params` passed to a meta-estimator’s fit.

    **kwargs dict

      Parameters explicitly accepted and included in the router’s method signature.

  Returns:
    routed_params Bunch

      A `Bunch` of the form `{"object_name": {"method_name": {prop: 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()`.

## Examples using `sklearn.utils.metadata_routing.process_routing`

Metadata Routing

Metadata Routing