braindecode.augmentation.functional.mask_encoding#
- braindecode.augmentation.functional.mask_encoding(X, y, time_start, segment_length, n_segments)[source]#
Mark encoding from Ding et al. (2024) from [ding2024].
Replaces a contiguous part (or parts) of all channels by zeros (if more than one segment, it may overlap).
Implementation based on [ding2024]
- Parameters:
X (torch.Tensor) – EEG input example or batch.
y (torch.Tensor) – EEG labels for the example or batch.
time_start (torch.Tensor) – Tensor of integers containing the position (in last dimension) where to start masking the signal. Should have “n_segments” times the size of the first dimension of X (i.e. “n_segments” start positions per example in the batch).
segment_length (int) – Length of each segment to zero out.
n_segments (int) – Number of segments to zero out in each example.
- Returns:
torch.Tensor – Transformed inputs.
torch.Tensor – Transformed labels.
References