cpm

Trains Connectome Predictive Models on functional connectivity matrices with fold-local edge selection.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Predicting behavioral or clinical outcomes from brain functional connectivity requires careful feature selection that avoids data leakage across cross-validation folds. This Skill implements Connectome Predictive Modeling (CPM) with edge selection repeated independently inside every training fold, producing unbiased classification or regression predictions from subject-level connectomes. ## Core Features & Use Cases - Fold-Local Edge Selection: Selects positive and negative network edges by correlation p-threshold within each training fold only, preventing leakage. - Classification and Regression: Supports both discrete diagnosis prediction (class and probability) and continuous cognitive score prediction from FC matrices or edge vectors. - Full Provenance Outputs: Writes predictions.csv, fold_assignments.csv, metrics.json, checkpoint.joblib models, config.json, and run_manifest.json for reproducible neuroimaging research. - Use Case: Given resting-state fMRI connectomes for 200 subjects and a cognitive score per subject, run the regression workflow to predict held-out scores and obtain per-fold performance metrics. ## Quick Start Run the CPM regression workflow on my connectomes.npz and labels.csv files with a p-threshold of 0.01 and 5-fold cross-validation, saving results to an output directory.

Frequently Asked Questions about cpm

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

FAQPage Schema
How do I run Connectome Predictive Modeling on fMRI data?

Prepare a connectomes.npz file containing X (subjects by nodes by nodes, or subjects by edges) and subject_id arrays, plus a labels.csv keyed by subject ID. Then run train_reference.py with --task regression or classification, a p-threshold, and the number of folds.

What input format does CPM edge selection require?

CPM expects functional connectivity data as an .npz file with an X array of shape [subjects, nodes, nodes] or [subjects, edges], plus a subject_id array. Labels come from a CSV file sharing the same subject IDs with a target column.

Why does CPM repeat edge selection inside each training fold?

Selecting edges on the full dataset before cross-validation leaks information from test folds into training, inflating accuracy. Fold-local selection recomputes significant edges using only training subjects in each fold, yielding unbiased performance estimates.

Can I tune the p-threshold for connectome prediction?

Yes, but tuning p-threshold on the full cross-validation loop introduces selection bias. Use nested cross-validation or select the threshold on training data only, as noted in the Skill documentation.

What outputs does a CPM training run produce?

Each run writes predictions.csv with per-subject predictions, fold_assignments.csv, metrics.json with performance scores, checkpoint.joblib fold models, and provenance files config.json and run_manifest.json in the specified output directory.