Toggle Menu
Prev Up Next

scikit-learn 1.3.2
Other versions

Please cite us if you use the software.

# `sklearn.utils.metadata_routing`.get_routing_for_object

sklearn.utils.metadata_routing.get_routing_for_object(obj=None)

  Get a `Metadata{Router, Request}` instance from the given object.

  This function returns a `MetadataRouter` or a `MetadataRequest` from the given input.

  This function always returns a copy or an instance constructed from the input, such that changing the output of this function will not change the original object.

  New in version 1.3.

  Parameters:
    obj object
      - If the object is already a

          `MetadataRequest` or a `MetadataRouter`, return a copy of that.

      - If the object provides a `get_metadata_routing` method, return a copy

          of the output of that method.

      - Returns an empty `MetadataRequest`

          otherwise.

  Returns:
    obj MetadataRequest or MetadataRouting

      A `MetadataRequest` or a `MetadataRouting` taken or created from the given object.

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

Metadata Routing

Metadata Routing