RandomNoise¶
- class torcheeg.transforms.RandomNoise(mean: float = 0.0, std: float = 1.0, p: float = 0.5, apply_to_baseline: bool = False)[source][source]¶
Add random noise conforming to the normal distribution on the EEG signal.
transform = RandomNoise(p=0.5) transform(eeg=torch.randn(32, 128))['eeg'].shape >>> (32, 128)
- Parameters
mean (float) – The mean of the normal distribution of noise. (defualt:
0.0)std (float) – The standard deviation of the normal distribution of noise. (defualt:
0.0)p (float) – Probability of adding noise to EEG signal samples. Should be between 0.0 and 1.0, where 0.0 means no noise is added to every sample and 1.0 means that noise is added to every sample. (defualt:
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. (defualt:
False)
- __call__(*args, eeg: Tensor, baseline: Optional[Tensor] = 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 adding random noise.
- Return type
torch.Tensor