braindecode.augmentation.Transform

class braindecode.augmentation.Transform(probability=1.0, random_state=None)

Basic transform class used for implementing data augmentation operations.

Parameters
operationcallable

A function taking arrays X, y (inputs and targets resp.) and other required arguments, and returning the transformed X and y.

probabilityfloat, optional

Float between 0 and 1 defining the uniform probability of applying the operation. Set to 1.0 by default (e.g always apply the operation).

random_state: int, optional

Seed to be used to instatiate numpy random number generator instance. Used to decide whether or not to transform given the probability argument. Defaults to None.

Methods

forward(X: torch.Tensor, y: Optional[torch.Tensor] = None) Tuple[torch.Tensor, torch.Tensor]

General forward pass for an augmentation transform.

Parameters
Xtorch.Tensor

EEG input example or batch.

ytorch.Tensor | None

EEG labels for the example or batch. Defaults to None.

Returns
torch.Tensor

Transformed inputs.

torch.Tensor, optional

Transformed labels. Only returned when y is not None.

get_params(*batch)

Examples using braindecode.augmentation.Transform