EEGInceptionEncoder
- class selfeeg.models.encoders.EEGInceptionEncoder(Chans: int, F1: int = 8, D: int = 2, kernel_size: int = 64, pool: int = 4, dropRate: float = 0.5, ELUalpha: float = 1.0, bias: bool = True, batch_momentum: float = 0.1, max_depth_norm: float = 1.0, seed: int = None)[source]
Pytorch Implementation of the EEGInception Encoder.
See EEGInception for some references. The expected input is a 3D tensor with size (Batch x Channels x Samples).
- Parameters:
Chans (int) – The number of EEG channels.
F1 (int, optional) –
The number of filters in the first temporal convolutional layer. Other output filters will be calculated according to the paper specification.
Default = 8
D (int, optional) –
The depth of the depthwise convolutional layer.
Default = 2
kernel_size (int, optional) –
The length of the temporal convolutional layer.
Default = 64
pool (int, optional) –
The temporal pooling kernel size.
Default = 4
dropRate (float, optional) –
The dropout percentage in range [0,1].
Default = 0.5
ELUalpha (float, optional) –
The alpha value of the ELU activation function.
Default = 1
bias (bool, optional) –
If True, adds a learnable bias to the output.
Default = True
batch_momentum (float, optional) –
The batch normalization momentum.
Default = 0.9
max_depth_norm (float, optional) –
The maximum norm each filter can have in the depthwise block. If None no constraint will be included.
Default = 1.
seed (int, optional) –
A custom seed for model initialization. It must be a nonnegative number. If None is passed, no custom seed will be set
Default = None
Example
>>> import selfeeg.models >>> import torch >>> x = torch.randn(4,8,64) >>> mdl = models.EEGInceptionEncoder(8) >>> out = mdl(x) >>> print(out.shape) # shoud return torch.Size([4, 12]) >>> print(torch.isnan(out).sum()) # shoud return 0