This repository contains the PyTorch implementation used for the revised manuscript. The code is organized to reproduce the main cross-validation experiments with fMRI functional connectivity and DTI structural connectivity matrices.
The proposed model is implemented in PyTorch. The default configuration follows the revised manuscript:
- Optimizer: Adam
- Initial learning rate:
5e-5 - Weight decay:
5e-6 - Epochs:
300 - Batch size:
20 - Cross-validation: 10 folds with random seed
7 - Local branch: single-layer graph attention network integrated with self-attention
- Global branch: PageRank-based graph attention integrated with self-attention
- Classifier: flattened global-local features followed by a multi-layer perceptron
config/ Experiment configuration
data/ Data loader and data-format documentation
models/ GLGAN model implementation
training/ Cross-validation training and metrics
utils/ Logging and reproducibility helpers
experiments/ Reproduction commands for main and ablation experiments
analysis/ ROC, t-SNE, parameter-count, hubness, sensitivity, and ROI analysis scripts
tests/ Basic checks for data loading, model forward pass, and training
main.py Command-line entry point
conda create -n glgan python=3.8 conda activate glgan pip install -r requirements.txt
The experiments in the manuscript were run on an NVIDIA GeForce RTX 3080 12GB GPU. CPU execution is supported for installation checks but is not recommended for full 300-epoch cross-validation.
ADNI data are governed by the ADNI data-use agreement and are not redistributed in this repository. After obtaining access from ADNI, place the processed .mat files under:
data/raw/
|-- ADNI_fmri.mat
`-- ADNI_DTI.mat
Expected arrays:
- fMRI connectivity:
[n_subjects, 90, 90], or regional time series[n_subjects, 90, time_points]from which the loader computes Pearson connectivity. - DTI connectivity:
[n_subjects, 90, 90]. - Labels: a vector stored in the fMRI
.matfile. Use--label-keyif the key is not one oflabel,labels,y,Y,gnd, ortarget.
See data/README.md for details.
With the default file names:
python main.py
If your .mat variable names differ:
python main.py --fmri-key fmri --dti-key dti --label-key label
To select a binary task from multi-class labels:
python main.py --class-values 0 1 --output-dir results/NC_SMC
Results are written to:
results/
|-- fold_metrics.csv
|-- aggregate_metrics.csv
|-- training.log
`-- checkpoints/
The code exposes the main ablation switches used to reproduce component-removal experiments:
python main.py --disable-local --output-dir results/ablation_no_local python main.py --disable-global --output-dir results/ablation_no_global python main.py --disable-pagerank --output-dir results/ablation_no_pagerank python main.py --disable-self-attention --output-dir results/ablation_no_self_attention
Additional notes are in experiments/README.md.
Post-processing scripts for common manuscript analyses are provided under analysis/. They operate on outputs generated by the GLGAN training workflow.
python -m analysis.parameter_count --output results/analysis/parameter_count.csv python -m analysis.roc_analysis --input predictions.csv --output results/analysis/roc_points.csv python -m analysis.tsne_analysis --features features.npy --labels labels.npy --output results/analysis/tsne_coordinates.csv python -m analysis.hubness_analysis --adjacency adjacency.npy --output results/analysis/hubness.csv python -m analysis.roi_ranking --input results/analysis/hubness.csv --output results/analysis/top_rois.csv python -m analysis.sensitivity_statistics --input sensitivity_results.csv --parameter-column learning_rate --metric-column accuracy
The ROC script expects a CSV with label and score columns. The t-SNE script expects a NumPy feature matrix shaped [n_samples, n_features].
To confirm that the repository is installed correctly:
python -m unittest discover -s tests -v
Please cite the corresponding manuscript if you use this code.