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.TargetConfoundRemover#

class julearn.transformers.target.TargetConfoundRemover(model_confound=None, confounds='confound', threshold=None)#

Remove confounds from the target.

Parameters:
model_confoundModelLike, optional

Sklearn compatible model used to predict specified features independently using the confounds as features. The predictions of these models are then subtracted from each of the specified features, defaults to LinearRegression().

confoundsstr or list of str, optional

The name of the ‘confounds’ type(s), i.e. which column type(s) represents the confounds. By default this is set to ‘confounds’.

thresholdfloat, optional

All residual values after confound removal which fall under the threshold will be set to 0. None (default) means that no threshold will be applied.

__init__(model_confound=None, confounds='confound', threshold=None)#
property needed_types: List[str] | Set[str] | str | ColumnTypes#

Get the needed column types.

fit(X, y)#

Fit ConfoundRemover.

Parameters:
Xpd.DataFrame

Training data for the confound remover.

ypd.Series

Training target values.

Returns:
TargetConfoundRemover

The fitted target confound remover.

transform(X, y)#

Remove confounds from the target.

Parameters:
Xpd.DataFrame

Testing data for the confound remover.

ypd.Series

Target values.

Returns:
pd.Series

The target with confounds removed.

fit_transform(X, y)#

Fit and transform the target.

Parameters:
Xpd.DataFrame

The input data.

yDataLike

The target.

Returns:
DataLike

The transformed target.