spd_learn.models.PhaseSPDNet#

class spd_learn.models.PhaseSPDNet(subspacedim=None, input_type='raw', threshold=0.0001, upper=True, n_chans=None, n_outputs=None, order=1, lag=1)[source]#

Bases: Module

Phase SPDNet.

This class implements the Phase SPDNet model [Carrara* et al., 2024]. This model first applies a Phase-Space Embedding (PSE) to the input time series data, followed by an SPDNet for classification.

Phase SPDNet Architecture
Parameters:
  • subspacedim (int, optional) – The dimension of the subspace for the SPDNet’s bilinear mapping layers. If None, it defaults to n_chans * order.

  • input_type (str, default="raw") – Specifies the input type for the SPDNet component.

  • threshold (float, default=1e-4) – Regularization threshold used within SPDNet.

  • upper (bool, default=True) – If True, uses the upper triangular part for certain operations within SPDNet.

  • n_chans (int) – Number of channels in the original input time series.

  • n_outputs (int) – Number of output units for the final classification or regression layer.

  • order (int, default=1) – The embedding order (dimension) for the Phase-Space Embedding.

  • lag (int, default=1) – The time lag used between consecutive samples in the Phase-Space Embedding.

forward(input)[source]#

Forward pass of the PhaseSPDNet model.

Parameters:

input (torch.Tensor) – Input tensor of shape (batch_size, n_chans, n_times).

Returns:

Output tensor of shape (batch_size, n_outputs).

Return type:

torch.Tensor