channel_dropout

selfeeg.augmentation.functional.channel_dropout(x: ArrayLike, Nchan: int = None, batch_equal: bool = True) ArrayLike[source]

puts to 0 a given (or random) amount of channels of the ArrayLike object.

Channels are selected randomly.

Parameters:
  • x (ArrayLike) – The input Tensor or Array. The last two dimensions must refer to the EEG recording (Channels x Samples).

  • Nchan (int, optional) –

    Number of channels to drop. If not given, the number of channels is chosen at random in the interval [1, (Channel_total // 4) +1 ].

    Default = None

  • batch_equal (bool, optional) –

    Whether to apply the same channel drop to all EEG records or not.

    Default = True

Returns:

x (ArrayLike) – the augmented version of the input Tensor or Array.

Example

>>> import torch
>>> import selfeeg.augmentation as aug
>>> x = torch.ones(32,1024)*2 + torch.sin(torch.linspace(0, 8*torch.pi,1024))
>>> xaug = aug.channel_dropout(x, 3)
>>> print( (xaug[0:,10]==0).sum()==3) # should return True