EEG data augmentation, without fooling yourself

EEG datasets are small and deep models are hungry. Augmentation creates more training trials. Done carelessly, it also creates near-copies of test trials.

Updated

Augmentation applies transformations to existing trials that should not change their label, such as a little noise, a small shift in time, or a different gain. The model sees more variety and overfits less. It is most useful for deep models trained on a few hundred trials, which describes most EEG studies.

There is one rule above all: augment after the split, and only the training set. An augmented copy of a test trial in the training data is leakage, and it inflates the score.

Nine augmentations, chainable

These are the Augmentation step in BCILattice's Analysis Suite. They chain into a pipeline with a fixed random seed, every parameter carries its real range and unit, and the step reports what the synthesis did to the data. An augmentation that grows the trial count while flattening the spectrum is a warning sign, not a success.

AugmentationWhat it does
GaussianNoiseAdds white noise scaled to reach a target SNR.
TimeShiftRandom circular shift along the time axis.
FrequencyShiftTranslates the spectrum by a random offset via the analytic signal.
ChannelDropoutZeroes random channels, so a decoder cannot depend on one electrode.
TimeReverseFlips the time axis.
AmplitudeScaleRandom per-epoch gain, modelling session-to-session impedance differences.
SlidingWindowProduces overlapping windows from each epoch.
MixUpConvex combination of two epochs of the same class.
SMOTEInterpolates between same-class nearest neighbours to rebalance minority classes.

Generative synthesis

For larger gains, generative models synthesise new trials. BCILattice has GAN Trainer and Diffusion Generator blocks on the ML canvas, and both check that generated trials are not copies of real ones, because a generator that memorises its training set adds leakage, not data.

Pick transforms that respect the physiology

  • Frequency shift and motor imagery

    Shifting the spectrum moves mu and beta. Keep shifts small or skip this for band-defined effects.

  • Time reverse and ERPs

    A reversed P300 is not a P300. Avoid it for evoked paradigms.

  • Sliding windows and splits

    Overlapping windows from one trial must stay on the same side of the split.

  • SMOTE

    Rebalances classes but interpolates in feature space, which can create implausible trials. Use it on features rather than raw epochs.

Questions

Does data augmentation help EEG classification?

Often, for deep models on small datasets, especially noise, time shifts, amplitude scaling and channel dropout. The gain should be measured on a properly held-out test set that was never augmented.

Should I augment before or after splitting the data?

After. Split first, then augment only the training data. Augmenting before the split puts near-copies of test trials into training and inflates accuracy.

Can GANs generate realistic EEG?

They can generate trials that improve training, but generated trials must be checked for memorisation (copies of real trials) and judged by whether they help on held-out data, not by how real they look.

Read the reference

Related

Run a study end to end, on your own machine

The free plan covers two studies, the full analysis suite, and 118 of the 119 ML blocks.