Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the What you really need to know section for the big picture.

julearn.transformers.target.JuTargetTransformer

class julearn.transformers.target.JuTargetTransformer

Base class for target transformers.

Unlike the scikit-learn transformer, this fits and transforms using both X and y. This is useful for pipelines that work on the target but require information from the input data, such as the TargetConfoundRemover or a target encoder that requires one of the features to be present.

IMPORTANT: Using any of the transformers that transforms the target based on the input data will result in data leakage if the features are not dropped after the transformation.

__init__(*args, **kwargs)
fit_transform(X, y)

Fit and transform the target.

Parameters:
Xpd.DataFrame

The input data.

yDataLike

The target.

Returns:
DataLike

The transformed target.

fit(X, y)

Fit the target.

Parameters:
Xpd.DataFrame

The input data.

yDataLike

The target.

Returns:
JuTargetTransformer

The fitted transformer.

transform(X, y)

Transform the target.

Parameters:
Xpd.DataFrame

The input data.

yDataLike

The target.

Returns:
DataLike

The transformed target.