MetadataRequest#

class sklearn.utils.metadata_routing.MetadataRequest(owner)[source]#

Contains the metadata request info of a consumer.

Instances of MethodMetadataRequest are used in this class for each available method under metadatarequest.{method}.

Consumer-only classes such as simple estimators return a serialized version of this class as the output of get_metadata_routing().

Added in version 1.3.

Parameters:
ownerstr

The name of the object to which these requests belong.

consumes(method, params)[source]#

Return params consumed as metadata in a consumer.

This method returns the subset of given params that are consumed by the given method. It can be used to check if parameters are used as metadata in the specified method of the consumer that owns this MetadataRequest instance.

Added in version 1.4.

Parameters:
methodstr

The name of the method for which to determine consumed parameters.

paramsiterable of str

An iterable of parameter names to test for consumption.

Returns:
consumed_paramsset of str

A subset of parameters from params which are consumed by the given method.