bnt

Trains BrainNetworkTransformer on dense fMRI functional connectivity matrices for phenotype prediction.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Running the BrainNetworkTransformer (BNT) model on neuroimaging data normally requires adapting the original hydra/PyG-based codebase to your own datasets. This Skill provides a NeuroClaw reimplementation that loads preprocessed ROI-level FC matrices directly, trains BNT with DEC pooling for classification or regression, and evaluates with K-fold cross-validation. ## Core Features & Use Cases - Dense FC input without PyG: Loads NeuroClaw .pt files (Fisher-z transformed FC matrices), inverts to Pearson r via tanh, and feeds dense [B, N, N] tensors to a pure PyTorch model. - Classification and regression: Supports phenotype classification (e.g., gender) and regression (e.g., age) with z-score label standardization and stratified K-fold CV. - Interpretability outputs: Exposes transformer attention weights and DEC soft cluster assignments for ROI importance and clustering analysis. - Optional T1 fusion: Concatenates z-scored gray matter volume as an extra node feature column when --include-t1 is set. - Use Case: Given HCP subjects preprocessed into data/braingnn_input/schaefer_100_7net/, train a 5-fold CV classifier predicting gender from FC matrices with T1 volume fusion. ## Quick Start Ask the agent to train the BNT model on the aal_116 atlas with the HCP gender labels CSV using 5-fold cross-validation and 50 epochs.

Frequently Asked Questions about bnt

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

FAQPage Schema
How do I train BrainNetworkTransformer on fMRI functional connectivity data?

Run models/bnt/scripts/train.py with an atlas name, a labels CSV, and fold settings. The script loads dense FC matrices from data/braingnn_input/<atlas>/, builds the BNT model, and trains with cross-entropy or MSE loss plus a weighted DEC KL loss.

Does BrainNetworkTransformer require PyTorch Geometric?

No. This BNT implementation uses dense [B, N, N] FC matrices with standard torch.utils.data Dataset and DataLoader, so torch_geometric and torch_sparse are not needed. It shares the same preprocessed data source as BrainGNN but consumes it in dense form.

Can BNT do regression tasks like age prediction?

Yes. Pass --task regression with a labels CSV containing a continuous column such as age. The model sets nclass=1, outputs a raw scalar, trains with MSELoss, and applies z-score label standardization based on training set statistics.

What input data format does BNT expect?

BNT expects per-subject .pt files under data/braingnn_input/<atlas>/ containing a Fisher-z transformed fc_matrix tensor of shape [n_roi, n_roi]. At load time the matrix is converted back to Pearson r with torch.tanh and the diagonal is zeroed.

Why does the number of attention heads cause errors in BNT?

The transformer requires forward_dim (N plus positional embedding dimension) to be divisible by nhead. The NeuroClaw implementation automatically lowers nhead to the largest compatible value, but manually chosen nhead values must satisfy this divisibility constraint.

How do I interpret BNT model predictions for ROI importance?

Each TransPoolingEncoder layer stores attention weights that can be analyzed for ROI importance. The DEC pooling soft assignment matrices can also be mapped back to ROIs to visualize learned cluster structures.