RandomMask¶
- class torcheeg.transforms.RandomMask(ratio: float = 0.5, p: float = 0.5, apply_to_baseline: bool = False)[source][source]¶
Overlay the EEG signal using a random mask, and the value of the overlaid data points was set to 0.0.
transform = RandomMask() transform(eeg=torch.randn(32, 128))['eeg'].shape >>> (32, 128)
- Parameters:
ratio (float) – The proportion of data points covered by the mask out of all data points for each EEG signal sample. (default:
0.5
)p (float) – Probability of applying random mask on EEG signal samples. Should be between 0.0 and 1.0, where 0.0 means no mask is applied to every sample and 1.0 means that masks are applied to every sample. (default:
0.5
)apply_to_baseline – (bool): Whether to act on the baseline signal at the same time, if the baseline is passed in when calling. (default:
False
)
- __call__(*args, eeg: Tensor, baseline: Tensor | None = None, **kwargs) Dict[str, Tensor] [source][source]¶
- Parameters:
eeg (torch.Tensor) – The input EEG signal.
baseline (torch.Tensor, optional) – The corresponding baseline signal, if apply_to_baseline is set to True and baseline is passed, the baseline signal will be transformed with the same way as the experimental signal.
- Returns:
The output EEG signal after applying a random mask.
- Return type:
torch.Tensor