ertk.transform.group_transform

ertk.transform.group_transform(x: ndarray, groups: ndarray, transform: TransformerMixin, *, inplace: bool = False, **fit_params)

Per-group (offline) transformation (e.g. standardisation).

Parameters:
x: np.ndarray

The data matrix to transform. Each x[i] must be an instance.

groups: np.ndarray

Groups assignment for each instance. It must be the case that len(groups) == len(x).

transform:

The transformation to apply. Must implement fit_transform().

inplace: bool

Whether to modify x in-place. Default is False so that a copy is made.

**fit_params:

Other keyword arguments to pass to the transform.fit() method.

Returns:
x: np.ndarray

The modified data matrix with transformations applied to each group individually.