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_confound (ModelLike | None, default: None) – 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().

  • confounds (list[str] | set[str] | str | ColumnTypes, default: 'confound') – The name of the ‘confounds’ type(s), i.e. which column type(s) represents the confounds. By default this is set to ‘confounds’.

  • threshold (float | None, default: None) – 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: ColumnTypesLike

Get the needed column types.

fit(X, y)

Fit ConfoundRemover.

Parameters:
  • X (DataFrame) – Training data for the confound remover.

  • y (Series) – Training target values.

Returns:

The fitted target confound remover.

transform(X, y)

Remove confounds from the target.

Parameters:
  • X (DataFrame) – Testing data for the confound remover.

  • y (Series) – Target values.

Returns:

The target with confounds removed.

fit_transform(X, y)

Fit and transform the target.

Parameters:
Returns:

The transformed target.