braindecode.training.mixup_criterion

braindecode.training.mixup_criterion(preds, target)

Implements loss for Mixup for EEG data. See [1].

Implementation based on [2].

Parameters
predstorch.Tensor

Predictions from the model.

targettorch.Tensor | list of torch.Tensor

For predictions without mixup, the targets as a tensor. If mixup has been applied, a list containing the targets of the two mixed samples and the mixing coefficients as tensors.

Returns
lossfloat

The loss value.

References

1

Hongyi Zhang, Moustapha Cisse, Yann N. Dauphin, David Lopez-Paz mixup: Beyond Empirical Risk Minimization Online: https://arxiv.org/abs/1710.09412

2

https://github.com/facebookresearch/mixup-cifar10/blob/master/train.py