Skip to content

Target encoder

fyt.registries.target_encoder

TargetEncoderRegistry

Bases: ComponentRegistry[BaseEstimator]

Registry for target encoding strategies.

Note

Target encoding strategies are designed to encode the target variable (labels) in a way that can be used by machine learning models.

create(key, class_mapping=None, **kwargs) classmethod

Create a target encoder.

Overrides the base create to accept a class_mapping parameter, which is injected into kwargs before delegation.

Parameters:

Name Type Description Default
key str | Enum

Strategy identifier.

required
class_mapping dict[str, int] | None

Optional mapping from class labels to integers.

None
**kwargs Any

Forwarded to the registered factory callable.

{}

Returns:

Type Description
BaseEstimator | None

Encoder instance or None for passthrough.