braindecode.augmentation.functional.label_smoothing#

braindecode.augmentation.functional.label_smoothing(X, y, epsilon, num_classes=None)[source]#

Smooth targets toward the uniform distribution over the classes.

See [1] for details.

Parameters:
  • X (Tensor) – EEG data in form batch_size, n_channels, n_times. Returned unchanged.

  • y (Tensor) – Target of length batch_size holding class indices (float values are accepted when they are integral), or a floating-point tensor of shape batch_size, num_classes holding target distributions.

  • epsilon (float) – Smoothing parameter between 0 and 1: the weight of the uniform distribution mixed into the targets. 0 returns the unsmoothed targets.

  • num_classes (int | None) – Number of classes. Required when y holds class indices; when y already holds distributions, it must match the size of the last dimension of y. Defaults to None.

Returns:

X, y. Where X is unchanged and y is a floating-point tensor of shape batch_size, num_classes whose rows sum to one.

Return type:

tuple[Tensor, Tensor]

References

[1]

Christian Szegedy, Vincent Vanhoucke, Jonathon Shlens and Zbigniew Wojna (2016). Rethinking the Inception Architecture for Computer Vision. In 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2818-2826. Online: https://arxiv.org/abs/1512.00567