braindecode.augmentation.TrivialAugment#

class braindecode.augmentation.TrivialAugment(probability=1.0, sfreq=None, sensors_positions_matrix=None, num_bins=10, random_state=None)[source]#

Apply one randomly sampled label-preserving augmentation per example.

For every example, independently samples one transform from the pool below and one of num_bins strengths evenly spaced between that transform’s bounds, as in TrivialAugment [1]. Examples that draw the same transform and strength are transformed in one call; each pooled transform still draws its own randomness per example.

Default pool (no assumption on the signal’s unit, sampling frequency or montage):

  • TimeReverse — no strength parameter.

  • SignFlip — no strength parameter.

  • FTSurrogate — phase noise magnitude, 0.2 to 1.

  • ChannelsDropout — channel drop probability, 0.05 to 0.4.

  • ChannelsShuffle — shuffle probability, 0.1 to 0.75.

  • SmoothTimeMask — mask length as a fraction of the window length, 0.05 to 0.25.

  • GaussianNoise — noise standard deviation as a fraction of the sub-batch standard deviation (volts or microvolts alike), 0.02 to 0.3.

  • AmplitudeScale — scale interval (1/s, s), s from 1.25 to 2.5.

sfreq adds BandstopFilter (bandwidth 0.5 to 4 Hz, capped 2.5 Hz below Nyquist) and FrequencyShift (maximum shift 0.5 to 2 Hz); sensors_positions_matrix adds SensorsRotation around the z axis (5 to 25 degrees).

Parameters:
  • probability (float, optional) – Probability of augmenting each example. Defaults to 1.0.

  • sfreq (float | None, optional) – Sampling frequency of the signals, in Hz. Defaults to None.

  • sensors_positions_matrix (array-like | None, optional) – Sensor positions of shape (3, n_channels) (see SensorsRotation). Defaults to None.

  • num_bins (int, optional) – Number of strength levels per transform. Defaults to 10.

  • random_state (int | numpy.random.RandomState, optional) – Seed shared by the per-example sampler and every pooled transform. Defaults to None.

op_names#

Names of the transforms in the pool, in sampling order.

Type:

list of str

References

[1]

Müller, S. G., & Hutter, F. (2021). TrivialAugment: Tuning-free Yet State-of-the-Art Data Augmentation. Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 774-782.

Methods

operation(X, y)[source]#

Apply one sampled transform and strength to each example of X.