SpectralBrainGNN for fMRI Task Classification
- The paper introduces a spectral graph neural network that learns an MLP-based spectral filter via normalized Laplacian eigendecomposition for cognitive task decoding.
- The model architecture integrates two spectral convolution layers and an attention-based readout, achieving around 96% accuracy and outperforming established spatial GNN baselines.
- The implementation offers a reproducible codebase and rigorous benchmarking on the HCP dataset, highlighting the method’s practical potential in neuroimaging research.
SpectralBrainGNN is a spectral graph neural network tailored for cognitive task classification using functional magnetic resonance imaging (fMRI) connectomes. By directly exploiting the normalized graph Laplacian eigendecomposition and an exact spectral convolutional framework, it advances the analytic potential of brain network models for decoding complex neural states. The approach integrates machine learning with multi-scale graph feature extraction, offering rigorous mathematical formalism, a reproducible codebase, and benchmarked superiority over established spatial GNN baselines (Maji et al., 31 Dec 2025).
1. Mathematical Foundations
SpectralBrainGNN utilizes the normalized Laplacian , where is the weighted adjacency matrix and is the degree matrix. The normalized Laplacian is symmetric positive semi-definite with eigenvalues in . Fundamental to the method is the graph Fourier transform (GFT): the eigendecomposition yields an orthonormal basis and diagonal eigenvalue matrix . For node features , the GFT is and its inverse . SpectralBrainGNN applies convolution in the Fourier domain using an exact “GFT–IGFT sandwich”:
Classically, can be polynomial-parameterized, but SpectralBrainGNN directly learns for each eigenvalue, mapping spectral scales to filter strengths.
2. Model Architecture
The model processes, for each subject:
- Undirected graphs with nodes (ROIs), thresholded Pearson correlation adjacency , and node features (raw BOLD time-courses).
- Cognitive task labels ( classes).
It consists of two stacked spectral convolution layers with hidden dimension 64, each applying:
- Normalized Laplacian formation and one-time eigendecomposition (, ).
- Forward GFT: .
- Learnable spectral filter: via MLP evaluation at every .
- Inverse GFT: .
- Linear mixing and bias: .
- Nonlinearity and dropout.
An attention-based readout computes node scores (with ), normalizes them, and aggregates a learned global graph embedding. Classification proceeds via a fully-connected softmax head, optimized by cross-entropy loss.
Spectral filters naturally tune the balance between global (low-frequency, smooth) and local (high-frequency, oscillatory) brain network patterns, explicitly capturing multi-scale connectomic motifs.
3. Implementation Details
SpectralBrainGNN’s preprocessing utilizes the Human Connectome Project (HCP) Young Adult dataset with Schaefer parcellation ( ROIs; 5mm spherical masks). Node inputs are mean BOLD time series; edge weights are thresholded Pearson correlations. Task labels span seven conditions.
The standard protocol is:
- Data split: 60% train, 20% validation, 20% test (fixed splits; 30 replications).
- Hyperparameters: 2 spectral layers (), hidden , dropout 0.5, Adam optimizer ( learning rate, weight decay), 200 epochs, retaining the best on validation accuracy.
- To reduce variance: entire pipeline repeated 10 times.
4. Experimental Results
SpectralBrainGNN outperforms all compared baselines:
| Model | Accuracy [%] ± Std |
|---|---|
| SpectralBrainGNN | 96.25 ± 1.37 |
| ResGCN | 93.75 ± 0.35 |
| Graph-Mamba | 94.17 ± 0.86 |
| BrainMAP | 94.74 ± 0.07 |
| GCN/GAT/SAGE | 84–86 |
Precision, recall, and F1 (all ) are correspondingly elevated. Statistical comparison to BrainMAP yields . Analysis of the confusion matrix reveals 97% correct on 1,489 test graphs, with minor biologically plausible misclassifications (e.g., Emotion vs Gambling, Motor vs Social). While explicit ablations separating filter parametrizations were not performed, the results implicitly confirm the advantage of exact spectral filtering over spatial GNN methods.
A plausible implication is that further analysis of the learned could clarify how SpectralBrainGNN weighs connectivity regimes, and future ablations with polynomial/cayley filter alternatives are warranted for mechanistic insight.
5. Codebase and Reproducibility
Implementation is publicly released at https://github.com/gnnplayground/SpectralBrainGNN, encompassing:
data_processing.py: fMRI loading routines, Schaefer parcellation, correlation graph construction.models/spectral_brain_gnn.py: core spectral convolution and attention-based readout layers.train.py,evaluate.py: pipeline scripting for training, early stopping, metrics.- Requirements: PyTorch, numpy, nibabel, scikit-learn, networkx.
Running
1 |
python train.py --config config.yaml |
initiates default hyperparameter training and evaluation.
6. Position within the Graph Neuroscience Landscape
SpectralBrainGNN represents the current apex in spectral-based cognitive task classification in fMRI connectomics, demonstrating pronounced accuracy gains and reproducibility. Relative to other spectral GNNs in neuroimaging—such as HL-HGCNN, which leverages Hodge-Laplacians and Laguerre polynomial filtering for intelligence prediction in large fMRI cohorts (Huang et al., 2023), and SGT for fast spectral domain alignment in cortical surface analysis (He et al., 2019)—SpectralBrainGNN uniquely combines exact Laplacian eigendecomposition, MLP-spectral filtering, and brain-wide multi-scale attention readout for task-level state decoding. This suggests broad extensibility to alternate connectomic datasets and transferability to related cognitive phenotype prediction tasks.