eegproc.deep_learning.unsupervised.GNN.GCN_band_separated module
- class eegproc.deep_learning.unsupervised.GNN.GCN_band_separated.BandSeparatedGCNEncoder(timesteps, t_down, n_channels=14, n_bands=3, gcn_units=(64, 32), temporal_pool_sizes=None, emb_dim=128, dropout=0.1, activation='relu', use_batch_norm=False, graph_self_loop_bias=2.0, graph_identity_mix=0.0, graph_adjacency_reg_weight=0.0001, name='encoder_band_separated_gcn', **kwargs)[source]
Bases:
BaseEncoderBand-separated residual GCN encoder for EEG sequence data.
- Input shape:
(batch, timesteps, n_channels * n_bands)
- The flattened feature axis is interpreted in channel-major order:
[ch0_band0, ch0_band1, …, ch1_band0, ch1_band1, …]
- At each timestep, the input is reshaped to:
(batch, timesteps, n_channels, n_bands)
Each frequency band is then processed by its own independent GCN stack:
band_0 -> GCN stack 0 band_1 -> GCN stack 1 … band_k -> GCN stack k
- Therefore, every band has its own:
GraphConv weights
learnable electrode adjacency matrices
normalization layers
residual projections
Bands never mix inside the graph convolutions. Their node-preserving graph outputs are concatenated only after all per-band GCN stacks have completed.
- The output remains:
(batch, ceil(timesteps / t_down), emb_dim)
so it remains compatible with downstream BiLSTM sequence models.
- Parameters:
timesteps (
int)t_down (
int)n_channels (
int, default:14)n_bands (
int, default:3)gcn_units (
tuple[int,...], default:(64, 32))temporal_pool_sizes (
tuple[int,...] |None, default:None)emb_dim (
int, default:128)dropout (
float, default:0.1)activation (
str, default:'relu')use_batch_norm (
bool, default:False)graph_self_loop_bias (
float, default:2.0)graph_identity_mix (
float, default:0.0)graph_adjacency_reg_weight (
float, default:0.0001)name (
str, default:'encoder_band_separated_gcn')
- call(inputs, training=False)[source]
Encode each EEG frequency band with an independent electrode GCN.
- Parameters:
training (
bool, default:False)
- get_adjacency_matrices()[source]
Return one set of learned adjacency matrices per frequency band.
- Return type:
dict[str,dict[str,Tensor]]
- get_band_features(inputs, training=False)[source]
Expose per-band post-GCN node-preserving sequences for diagnostics.
- Parameters:
training (
bool, default:False)- Return type:
dict[str,Tensor]
- get_config()[source]
Return serializable configuration for the band-separated encoder.
- Return type:
dict
- property n_features: int
Flattened number of channel-band features per timestep.
- class eegproc.deep_learning.unsupervised.GNN.GCN_band_separated.GCNDecoder(timesteps, n_channels, n_bands, t_down, gcn_units, temporal_pool_sizes, emb_dim=128, dropout=0.1, activation='relu', use_batch_norm=False, graph_self_loop_bias=2.0, graph_identity_mix=0.0, graph_adjacency_reg_weight=0.0001, name='decoder_gcn', **kwargs)[source]
Bases:
ModelGraph-aware decoder for
GCNEncoderlatent sequences.The decoder first restores temporal resolution. It then projects each latent timestep into a distinct feature vector for every electrode, reshapes that vector back to a graph, and applies residual graph-convolution blocks before reconstructing the frequency-band values at each node.
This is intentionally different from a purely temporal Conv1D decoder: the output is reconstructed as
n_channelsgraph nodes rather than as one undifferentiated flat feature vector.- Parameters:
timesteps (
int)n_channels (
int)n_bands (
int)t_down (
int)gcn_units (
tuple[int,...])temporal_pool_sizes (
tuple[int,...] |None)emb_dim (
int, default:128)dropout (
float, default:0.1)activation (
str, default:'relu')use_batch_norm (
bool, default:False)graph_self_loop_bias (
float, default:2.0)graph_identity_mix (
float, default:0.0)graph_adjacency_reg_weight (
float, default:0.0001)name (
str, default:'decoder_gcn')
- call(inputs, training=False)[source]
Decode latent sequences into channel-specific EEG graph signals.
- Parameters:
training (
bool, default:False)
- fix_length(x)[source]
Trim or pad the reconstructed sequence to exactly
timesteps.- Parameters:
x (
Tensor)- Return type:
Tensor
- classmethod from_encoder(encoder, name='decoder_gcn')[source]
Create a graph-aware decoder from a configured encoder.
- Parameters:
encoder (
BandSeparatedGCNEncoder)name (
str, default:'decoder_gcn')
- Return type:
- get_adjacency_matrices()[source]
Return normalized decoder electrode graphs for diagnostics.
- Return type:
dict[str,Tensor]
- property n_features: int
Flattened number of reconstructed channel-band features.
- eegproc.deep_learning.unsupervised.GNN.GCN_band_separated.GCNEncoder
alias of
BandSeparatedGCNEncoder