This repository contains the Hopf-GAE, a physics-informed deep learning architecture that detects depression-related dynamical abnormalities without ever training on depressed brains. Rather than framing MDD detection as binary classification (which fails at
The key innovations:
-
Biophysically grounded node features — every node carries the per-region bifurcation parameter
$a_j$ , natural frequency$\omega_j$ , and goodness-of-fit$\chi^2_j$ estimated by the Stuart-Landau / Hopf bifurcation framework via the SL-UKF_Neural_Criticality_MDD & · SL-UKF_Neural_Criticality_MDDvsHC pipeline, plus Yeo 7-network one-hot encodings (11 features per ROI). To our knowledge, the first use of biophysically estimated dynamical parameters as node features in any GNN for fMRI. -
Multi-relational graph attention — three edge types (PLV phase synchrony, MVAR Granger causality, SC structural connectivity) with learned per-relation attention weights and edge-attribute-aware attention.
-
Coupled edge-node bottleneck — edge decoders operate on the trainable latent
$𝐳$ via concatenation$[𝐳_i | 𝐳_j]$ , creating a gradient path from the edge loss through the shared bottleneck into the node reconstruction pathway. When decoupled (edge decoders on frozen$𝐡$ ), the connectivity branch has identically zero effect on the anomaly score. -
Physics-only scoring — anomaly scores use reconstruction error on
$(a_j, \omega_j, \chi^2_j)$ exclusively. Four additional connectivity-derived features shape$𝐳$ during training but are excluded from the score, preventing connectivity-derived features from diluting the dynamical anomaly signal. -
Denoising graph autoencoder — Gaussian noise injection (
$\sigma = 0.1$ ) on encoder input and dropout ($p = 0.3$ ) on the latent code replace the variational bottleneck, which collapsed in all tested configurations due to low within-HC variance of bifurcation parameters.
|
Classification (insufficient data)
|
Normative anomaly detection (this work)
|
| Feature | Dim | Source | Meaning |
|---|---|---|---|
| 1 | SL-UKF_Neural_Criticality_MDD | Bifurcation parameter — distance from critical point | |
| 1 | Hilbert phase | Natural oscillation frequency (Hz) | |
| 1 | UKF fit | Goodness-of-fit (model–data agreement) | |
| Network one-hot | 8 | Yeo 7 + Subcortical | Functional network membership |
| Feature | Weight | Source | Enters Score? |
|---|---|---|---|
| 2.0 | UKF | Yes | |
| 1.0 | Hilbert | Yes | |
| 1.0 | UKF fit | Yes | |
| PLV node strength | 0.5 | Edge aggregation | No — shapes |
| MVAR in-strength | 0.5 | Edge aggregation | No — shapes |
| MVAR out-strength | 0.5 | Edge aggregation | No — shapes |
| Within-network PLV | 0.5 | Edge aggregation | No — shapes |
| Relation | Type | Source | Encoder Weight (Conv₁) |
|---|---|---|---|
| PLV | Undirected | Phase Locking Value | 0.76 |
| SC | Undirected | 0.19 | |
| MVAR | Directed | Lasso-MVAR | 0.05 |
Each GAT layer maintains separate learnable projections
where
Two multi-relational GAT layers (input_proj (
Denoising: During training, Gaussian noise (
Node path: Deterministic projection
Edge path (coupled): Three MLP edge decoders predict edge existence from
Graph-level loss: Per-graph mean and standard deviation of the bifurcation parameter
| Component | Shape | Parameters | Status |
|---|---|---|---|
|
|
198 | Trainable | |
| Linear decoder | 49 | Trainable | |
| Edge decoders (PLV, SC, MVAR) |
|
339 | Trainable |
| Total trainable | 586 |
z-scored against HC norms:
Loss function (GAE training):
with
Total parameters: 6,071
├── Frozen encoder: 5,485 (90%)
│ ├── conv1 (3-relation GAT, 11→32): 1,286
│ ├── conv2 (3-relation GAT, 32→32): 3,302
│ ├── input_proj (masked residual, 11→32): 352
│ └── physics_head (32→16→1): 545
└── Trainable GAE: 586 (10%)
├── fc_z (32→6): 198
├── linear_decoder (6→7): 49
└── edge_decoders (3 × MLP 12→8→1): 339
Coupled architecture: 3.2× fewer trainable params than decoupled (586 vs 1,882)
┌────────────┬─────────────────┬──────────────┬──────────────┬──────────────┬──────────────┐
│ Synthetic │ HC train │ HC holdout │ HC test │ MDD rest1 │ MDD rest2 │
│ n = 200 │ 24 subj (199s) │ ~5 subj (36s)│ 6 subj (60s) │ 19 subj │ 18 subj │
│ Stage 1 │ Stage 2 │ Test only │ Test only │ Test only │ Test only │
└────────────┴─────────────────┴──────────────┴──────────────┴──────────────┴──────────────┘
Synthetic + HC train = train | HC holdout + HC test + MDD = never trained on
The HC train/test split is by subject (not session) to prevent leakage. HC holdout subjects (~15%) provide an unbiased false positive rate estimate (0/36 = 0.0%). MDD subjects are never seen during any training stage. HC train vs. test overfitting check:
Coupled edge decoders on
Physics-only scoring (not Fisher LDA) — An earlier design used Fisher LDA to weight anomaly score components, but this introduced circularity: scoring weights were informed by the labels being tested, inflating effect sizes by ~2.8×. The physics-only score is strictly label-free.
Denoising autoencoder (not variational) — The variational bottleneck (
Linear decoder (49 parameters) — An MLP decoder can learn a mean-output shortcut: memorize the HC population mean and output it regardless of
Expanded reconstruction targets (7 features) — Reconstructing only
Node-level (not graph-level) bottleneck — Graph-level pooling into a single
Concatenation
Feature-weighted reconstruction — Weights
Outlier threshold: HC mean
| Metric | Value | 95% CI | UKF Reference |
|---|---|---|---|
| HC vs MDD separation |
|
— | — |
| Permutation null (10,000) | — | — | |
| HC holdout FP rate | 0/36 (0.0%) | — | — |
| HC holdout vs MDD | — | — | |
| Overfitting check | — | — | |
| Seed robustness (10 runs) |
|
— | — |
| Whole-brain intervention |
|
|
|
| Circuit intervention |
|
|
|
| Limbic intervention |
|
— | |
| Subcortical intervention |
|
— | |
| Circuit enrichment (top-10) | 2.19× (7/10), hypergeom |
— | — |
| Circuit enrichment (top-15) | 2.30× (11/15), hypergeom |
— | — |
| Circuit vs non-circuit |
|
— | — |
| Heterogeneity (raw |
|
— |
|
| Heterogeneity (raw |
|
— |
|
| #1 anomalous ROI | RH Default PFCdPFCm | — | Converges with Ch. 5 cluster |
| #1 anomalous network | Limbic | — | — |
All four intervention scales survive Benjamini-Hochberg FDR correction. Active group shows approximately stable anomaly (AWAY from HC), sham moves toward HC (decreased anomaly). Post-exclusion analysis:
| Feature | Cohen's |
Direction |
|---|---|---|
|
|
+6.07 | MDD worse reconstructed |
|
|
+5.91 | MDD worse reconstructed |
| MVAR in-strength | +5.17 | MDD worse reconstructed |
| MVAR out-strength | +4.93 | MDD worse reconstructed |
|
|
−1.76 | MDD better reconstructed |
| PLV within-network | +1.43 | MDD worse reconstructed |
| PLV node strength | +1.29 | MDD worse reconstructed |
The reversed sign on
| Rank | ROI | Network | Circuit? |
|---|---|---|---|
| 1 | RH Default PFCdPFCm | Default Mode | ✓ |
| 2 | LH Limbic TempPole₁ | Limbic | ✓ |
| 3 | LH Limbic TempPole₂ | Limbic | ✓ |
| 4 | LH Default Temp₅ | Default Mode | ✓ |
| 5 | LH Cont Cing₂ | Frontoparietal | |
| 6 | LH Default Par₁ | Default Mode | |
| 7 | RH SalVentAttn FrOperIns₁ | Salience/VentAttn | |
| 8 | NAcc-rh | Subcortical | ✓ |
| 9 | LH Default Temp₃ | Default Mode | ✓ |
| 10 | RH Default PFCdPFCm₃ | Default Mode | ✓ |
| Architecture | Trainable Params | HC–MDD |
Edge decoder input |
|---|---|---|---|
|
Coupled (edge on |
586 | +3.02 |
|
| Decoupled (edge on |
1,882 | +2.75 |
|
Coupled architecture achieves higher separation with 3.2× fewer trainable parameters.
The Hopf-GAE consumes outputs from the R biophysical pipeline (SL-UKF_Neural_Criticality_MDD & · SL-UKF_Neural_Criticality_MDDvsHC):
| Input | File | Format |
|---|---|---|
| Bifurcation parameters | results/v3/sl_stage1_results_216roi.csv |
CSV (one row per ROI per subject per session) |
| PLV matrices | results/v3/plv/plv_all_216roi.rds |
R list, keyed "subject_id|session" |
| MVAR matrices | results/v3/s2_mvar_all_216roi.rds |
R list, keyed "subject_id|session" |
| HC comparison data | results/ch5_v4def/ch5_v4def_results.rds |
R list |
|
Python packages |
Upstream (R pipeline) |
System: Python ≥ 3.9 · PyTorch ≥ 2.0 · PyTorch Geometric ≥ 2.4 · R ≥ 4.2 (for upstream pipeline only)
# 1. Ensure upstream pipeline has been run
# (github.com/skaraoglu/UKF-MDD)
# 2. Install Python dependencies
pip install torch torch_geometric pyreadr scikit-learn statsmodels
# 3. Run the full pipeline
jupyter execute main_analysis.ipynb
# Pipeline stages:
# S1–S6: Data loading, graph construction, quality control
# S7–S10: Synthetic pre-training (encoder, 100 epochs)
# S11–S12: HC data loading + augmentation, GAE training (200 epochs)
# S13: Anomaly scoring (physics-only, z-scored against HC norms)
# S14: Statistical analysis (FDR, permutation tests, enrichment)If you use this architecture or build on this work, please cite:
Built with PyTorch Geometric · Node dynamics from SL-UKF_Neural_Criticality_MDD · SL-UKF_Neural_Criticality_MDDvsHC· Parcellation: Schaefer 2018 + Melbourne Subcortex
