spd_learn.models.Green#
- class spd_learn.models.Green(n_outputs: int, n_chans: int, sfreq: int = 100, n_freqs_init: int = 10, kernel_width_s: float = 0.5, conv_stride: int = 1, oct_min: float = 0, oct_max: float = 3, random_f_init: bool = False, shrinkage_init: float | None = -3.0, logref: str = 'logeuclid', momentum: float | None = 0.9, dropout: float | None = 0.5, hidden_dim: List[int] | Tuple[int] | None = (8, ), pool_method: Callable = <function real_covariance>, bi_out: List[int] | Tuple[int] | None = None, dtype: dtype = torch.float32)[source]#
Bases:
ModuleGabor Riemann EEGNet.
This class implements the Gabor Riemann EEGNet (GREEN) model [Paillard et al., 2025]. GREEN is a neural network model that processes EEG epochs using convolutional layers, followed by the computation of SPD features.
- Parameters:
n_outputs (int) – Number of output classes for classification.
n_chans (int) – Number of input EEG channels.
sfreq (int, default=100) – Sampling frequency of the EEG data.
n_freqs_init (int, default=10) – Number of main frequencies in the wavelet family.
kernel_width_s (float, default=0.5) – Width of the wavelet kernel in seconds.
conv_stride (int, default=1) – Stride of the wavelet convolution.
oct_min (float, default=0) – Minimum frequency of interest in octaves.
oct_max (float, default=3) – Maximum frequency of interest in octaves.
random_f_init (bool, default=False) – Whether to randomly initialize the frequencies of interest.
shrinkage_init (float, optional, default=-3.0) – Initial shrinkage value before applying the sigmoid function.
logref (str, default="logeuclid") – Reference matrix used for the LogEig layer.
momentum (float, optional, default=0.9) – Momentum for the BatchReNorm layer.
dropout (float, optional, default=0.5) – Dropout rate for the fully connected layers.
hidden_dim (tuple[int] or list[int], optional, default=(8,)) – Dimensions of the hidden layers in the classification head.
pool_method (Callable, default=real_covariance) – Method for pooling the covariance matrices.
bi_out (tuple[int] or list[int], optional) – Output dimensions for the BiMap layers.
dtype (torch.dtype, default=torch.float32) – Data type of the tensors.
- forward(X: Tensor) Tensor[source]#
Forward pass through the GREEN model.
- Parameters:
X (torch.Tensor) – Input EEG data tensor with shape (batch_size, n_chans, n_times).
- Returns:
Output tensor with shape (batch_size, n_outputs).
- Return type: