eegproc.deep_learning.unsupervised.BaseEncoder module

class eegproc.deep_learning.unsupervised.BaseEncoder.BaseEncoder(timesteps, emb_dim, t_down, name='base_encoder', **kwargs)[source]

Bases: Model

Base class for EEG encoders.

Encoders map raw EEG sequences to latent sequence representations for downstream tasks such as reconstruction, classification, contrastive learning, or sequence modeling.

All subclasses should map an input sequence of shape (batch, timesteps, n_features) to a latent sequence of shape (batch, ceil(timesteps / t_down), emb_dim).

Parameters:
  • timesteps (int) – Number of timesteps in the input sequence.

  • emb_dim (int) – Dimensionality of the latent embedding at each output timestep.

  • t_down (int) – Temporal downsampling factor (divides timesteps by this value).

  • name (str, default: 'base_encoder') – Name of the Keras model.

  • **kwargs – Additional keyword arguments passed to tf.keras.Model.

call(inputs, training=False)[source]

Run the encoder forward pass.

Parameters:

training (bool, default: False)

compute_output_shape(input_shape)[source]

Return the encoder output shape.

property emb_dim: int

Dimensionality of the output embedding.

get_config()[source]

Return serializable configuration for the base encoder.

Return type:

dict

property n_features: int

Number of input features per timestep.

property output_timesteps: int

Number of output timesteps after downsampling.