braindecode.augmentation.FTSurrogate

class braindecode.augmentation.FTSurrogate(probability, phase_noise_magnitude=1, random_state=None)

FT surrogate augmentation of a single EEG channel, as proposed in [1].

Parameters
probability: float

Float setting the probability of applying the operation.

phase_noise_magnitudefloat | torch.Tensor, optional

Float between 0 and 1 setting the range over which the phase pertubation is uniformly sampled: [0, phase_noise_magnitude * 2 * pi]. Defaults to 1.

random_state: int | numpy.random.Generator, optional

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

References

1

Schwabedal, J. T., Snyder, J. C., Cakmak, A., Nemati, S., & Clifford, G. D. (2018). Addressing Class Imbalance in Classification Problems of Noisy Signals by using Fourier Transform Surrogates. arXiv preprint arXiv:1806.08675.

Methods

get_params(*batch)

Return transform parameters.

Parameters
Xtensor.Tensor

The data.

ytensor.Tensor

The labels.

Returns
paramsdict

Contains:

  • phase_noise_magnitudefloat

    The magnitude of the transformation.

  • random_statenumpy.random.Generator

    The generator to use.

static operation(X, y, phase_noise_magnitude, random_state=None)

FT surrogate augmentation of a single EEG channel, as proposed in [1].

Function copied from https://github.com/cliffordlab/sleep-convolutions-tf and modified.

Parameters
Xtorch.Tensor

EEG input example or batch.

ytorch.Tensor

EEG labels for the example or batch.

phase_noise_magnitude: float

Float between 0 and 1 setting the range over which the phase pertubation is uniformly sampled: [0, phase_noise_magnitude * 2 * pi].

random_state: int | numpy.random.Generator, optional

Used to draw the phase perturbation. Defaults to None.

Returns
torch.Tensor

Transformed inputs.

torch.Tensor

Transformed labels.

References

1

Schwabedal, J. T., Snyder, J. C., Cakmak, A., Nemati, S., & Clifford, G. D. (2018). Addressing Class Imbalance in Classification Problems of Noisy Signals by using Fourier Transform Surrogates. arXiv preprint arXiv:1806.08675.