ibgnn

Trains IBGNN graph neural networks on fMRI connectome data for phenotype prediction.

89|5|Updated Mar 25, 2026
One-click install
npx skills add https://github.com/CUHK-AIM-Group/NeuroDiscovery --skill ibgnn-cuhk-aim-group
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ibgnn
Source: https://github.com/CUHK-AIM-Group/NeuroDiscovery/tree/main/skills/ibgnn
Command: npx skills add https://github.com/CUHK-AIM-Group/NeuroDiscovery --skill ibgnn-cuhk-aim-group

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires torch, torch_geometric, numpy, scikit-learn, and includes scripts (resource) components.

What problem does it solve? Running interpretable graph neural networks on brain connectome data requires careful handling of PyG graph formats, edge-weight normalization, and task configuration, which this Skill packages into a reproducible training workflow for fMRI phenotype prediction. ## Core Features & Use Cases - IBGNN Training Pipeline: Trains the MPConv-based IBGNN model with learnable MLP message functions over [x_i, x_j, edge_attr] using K-fold cross-validation. - Classification and Regression Support: Handles both classification (e.g., gender prediction) and regression (e.g., HCP age prediction) through a unified interface with nclass and task flags. - BrainGNN Data Reuse: Loads preprocessed PyG Data graphs from data/braingnn_input/<atlas>/ via the shared NeuroClawFCDataset, avoiding duplicate preprocessing. - Use Case: A researcher with HCP functional connectivity matrices wants to predict subject age using an interpretable GNN; they run the reference training script with the schaefer_100_7net atlas and a labels CSV to get MAE metrics across folds. ## Quick Start Train IBGNN on the aal_116 atlas with my HCP gender labels CSV for 10 epochs on fold 0 as a smoke test.

Frequently Asked Questions about ibgnn

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I train IBGNN on fMRI connectivity data?

Run the train_reference.py script with an atlas name, a labels CSV, and fold index. It loads PyG graphs from data/braingnn_input/<atlas>/, builds the IBGNN model, and runs K-fold cross-validation with Adam optimization and cosine learning rate scheduling.

What input format does IBGNN require for brain graphs?

IBGNN takes PyTorch Geometric Data objects with node features x of shape [N, N] (FC matrix rows), edge_index, and edge_attr holding Pearson correlation weights. It reuses the BrainGNN NeuroClawFCDataset, so preprocessed sub-*.pt files work directly.

Can IBGNN do regression as well as classification?

Yes, set --task regression and the script uses nclass=1 with MSE loss and KFold splitting, reporting MAE. Classification uses cross-entropy with StratifiedKFold and reports accuracy.

Why does IBGNN apply abs() to edge attributes?

Functional connectivity matrices contain negative correlations, but GCN normalization and message aggregation assume non-negative weights. Applying edge_attr.abs() before normalization prevents NaN values during training.

Is IBGNN compatible with PyTorch Geometric 2.7?

Yes, the NeuroClaw implementation replaces the deprecated torch_scatter.scatter_add with torch_geometric.utils.scatter using reduce='sum', making it compatible with PyG 2.7.

What are the limitations of this IBGNN implementation?

The edge_flag mechanism and the post-hoc GNNExplainer from the original repository are not ported, so edge-mask explanation is unavailable. Also, more than 3 MPConv layers cause over-smoothing, so 2-3 layers are recommended.