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 UKF-MDD 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 | UKF-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 (UKF-MDD):
| 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 UKF-MDD Β· Parcellation: Schaefer 2018 + Melbourne Subcortex
