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.pipeline.JuTargetPipeline

class julearn.pipeline.JuTargetPipeline(steps)

Class for pipelines that work on the target.

Unlike the sklearn.pipeline.Pipeline, this pipeline 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 julearn.transformers.target.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.

Parameters:

steps (list[tuple[str, JuTargetTransformer | TransformerLike]]) – List of steps to be performed on the target.

__init__(steps)
fit_transform(X, y)

Fit and transform the target.

Parameters:
Returns:

The transformed target.

fit(X, y)

Fit the target pipeline.

Parameters:
Returns:

The fitted pipeline.

transform(X, y)

Transform the target.

Parameters:
Returns:

The transformed target.

inverse_transform(X, y)

Inverse transform the target.

Parameters:
Returns:

The inverse transformed target.

can_inverse_transform()

Check if the pipeline can inverse transform.

Returns:

True if the pipeline can inverse transform.

property needed_types

Get the needed types for the pipeline.

Returns:

The needed types for the pipeline.