eegproc.deep_learning.unsupervised.GNN.GraphConv module
Graph convolution layer used by EEGProc GCN encoders and decoders.
- class eegproc.deep_learning.unsupervised.GNN.GraphConv.GraphConv(units, n_nodes, activation='relu', use_bias=True, self_loop_bias=2.0, identity_mix=0.0, adjacency_reg_weight=0.0001, **kwargs)[source]
Bases:
LayerGraph convolution with a shared, learnable electrode adjacency matrix.
The graph nodes are EEG electrodes. Any frequency bands are node features, so the same
n_nodes x n_nodeselectrode graph is applied to every band before the learned feature projection mixes the band/features dimension. Inputs may contain any number of leading dimensions, including the native sequence shape(batch, time, n_nodes, features); graph operations are broadcast over all leading dimensions withoutTimeDistributed.The normalized adjacency is
A = (1 - identity_mix) * softmax(A_theta + self_loop_bias * I)`` + identity_mix * I``.self_loop_biasmakes training start from an electrode-preserving graph, whileidentity_mixcan guarantee a permanent local contribution. A small entropy penalty discourages the adjacency rows from remaining close to uniform global averaging.- Parameters:
units (
int) – Output feature dimensionality per electrode.n_nodes (
int) – Number of graph nodes/electrodes.activation (
str|None, default:'relu') – Activation applied after graph aggregation and linear projection.use_bias (
bool, default:True) – Whether to add a feature bias.self_loop_bias (
float, default:2.0) – Positive value added to the diagonal adjacency logits before softmax. With 14 electrodes, 2.0 starts with a diagonal weight around 0.36 before any optional identity mixture.identity_mix (
float, default:0.0) – Fixed proportion of the identity matrix mixed into the learned graph. Must be in[0, 1]. The GCN already has residual blocks, so zero is the recommended initial setting.adjacency_reg_weight (
float, default:0.0001) – Weight of the mean row-entropy penalty added throughadd_loss. Set to zero to disable adjacency regularization.