Confound-Corrected Connectome-Based Predictive Modelling in Python
Confound-Corrected Connectome-Based Predictive Modelling is a Python package for performing connectome-based predictive modeling (CPM). This toolbox is designed for researchers in neuroscience and psychiatry, providing robust methods for building predictive models based on structural or functional connectome data. It emphasizes replicability, interpretability, and flexibility, making it a valuable tool for analyzing brain connectivity and its relationship to behavior or clinical outcomes.
What is Connectome-Based Predictive Modeling?
Connectome-based predictive modeling (CPM) is a machine learning framework that leverages the brain's connectivity patterns to predict individual differences in behavior, cognition, or clinical status. By identifying key edges in the connectome, CPM creates models that link connectivity metrics with target variables (e.g., clinical scores). This approach is particularly suited for studying complex relationships in neuroimaging data and developing interpretable predictive models.
Key Features
- Univariate Edge Selection: Supports methods like
pearson,spearman, and their partial correlation counterparts, with options for p-threshold optimization and FDR correction. - Cross-Validation: Implements nested cross-validation for robust model evaluation.
- Edge Stability: Selects stable edges across folds to improve model reliability.
- Confound Adjustment: Controls for covariates during edge selection and modeling.
- Permutation Testing: Assesses the statistical significance of models using robust permutation-based methods.
Documentation
For detailed instructions on installation, usage, and advanced configurations, visit the documentation website.
Installation
Install the latest release from PyPI:
pip install cccpm
Or install the development version from GitHub:
git clone https://github.com/wwu-mmll/confound_corrected_cpm.git
cd confound_corrected_cpm
pip install .
CCCPM requires Python 3.10–3.14 and uses PyTorch for computation (CPU by default; CUDA/MPS used automatically when available). See the installation guide for platform-specific notes.
Quick Example
Here's a quick overview of how to run a CPM analysis:
from cccpm import CPMAnalysis, UnivariateEdgeSelection, PThreshold
from sklearn.model_selection import KFold
# Configure edge selection
univariate_edge_selection = UnivariateEdgeSelection(
edge_statistic="pearson",
edge_selection=[PThreshold(threshold=[0.05], correction=["fdr_by"])]
)
# Create the CPM analysis object
cpm = CPMAnalysis(
results_directory="results/",
cv=KFold(n_splits=10, shuffle=True, random_state=42),
edge_selection=univariate_edge_selection,
n_permutations=100
)
# Run the analysis
X = ... # Connectome data, shape (n_samples, n_features)
y = ... # Target variable, shape (n_samples,)
covariates = ... # Covariates to control for, shape (n_samples, n_covariates)
cpm.run(X=X, y=y, covariates=covariates)
Contributing
Contributions are welcome! If you have ideas, feedback, or feature requests, feel free to open an issue or submit a pull request on the GitHub repository.
Metadata
Release files for cccpm 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cccpm-0.5.0.tar.gz | 126.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cccpm-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 281.9 kB
Release files / cccpm-0.5.0.tar.gz
| Download URL | cccpm-0.5.0.tar.gz |
|---|---|
| Size | 126.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5c272b97290df11de0a8dadd6c9b28c03634dd64e86c19a8e5ddefb8034a50af
|
|
BLAKE2b-256 checksum How to use checksums |
0c97c39783bd47f97f5ee087436cbd89e0d2635bd37bff6dd06dd45cc3dea3ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.
Transparency logRelease files / cccpm-0.5.0-py3-none-any.whl
| Download URL | cccpm-0.5.0-py3-none-any.whl |
|---|---|
| Size | 155.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4555941ffd17c839aede7f0324171d3fe282ec13cb2ba7bd7a96c9f4fe861b1b
|
|
BLAKE2b-256 checksum How to use checksums |
2afdc2fa2d2d3c50b23c9a7079508504b9ecfc43ff527b2718e1407e90213a49
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.
Transparency log