braindecode.training.mixup_criterion#

braindecode.training.mixup_criterion(preds, target)[source]#

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

Implementation based on [2].

Parameters
  • preds (torch.Tensor) – Predictions from the model.

  • target (torch.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

loss – The loss value.

Return type

float

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

facebookresearch/mixup-cifar10