Skip to main content

GitHub Workflow Status Coverage Status Github Contributors Github Commits

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. `selection_input="residualized"` controls for the
# covariates while *selecting* edges.
univariate_edge_selection = UnivariateEdgeSelection(
    selection_statistic="pearson",
    selection_input="residualized",
    edge_selection=[PThreshold(threshold=[0.05], correction=["fdr_by"])]
)

# Create the CPM analysis object. `model_input` is the second, independent
# confound-control choice: deconfound the connectome the models consume.
cpm = CPMAnalysis(
    results_directory="results/",
    cv=KFold(n_splits=10, shuffle=True, random_state=42),
    edge_selection=univariate_edge_selection,
    model_input="residualized",
    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)   # covariates are optional

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.7.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cccpm 0.7.1
File Size Uploaded Provenance Actions
cccpm-0.7.1.tar.gz 140.6 kB With provenance Details for cccpm-0.7.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cccpm 0.7.1
File Interpreter ABI Platform Actions
cccpm-0.7.1-py3-none-any.whl Python 3 none any Details for cccpm-0.7.1-py3-none-any.whl

Total release size: 312.9 kB

Release files / cccpm-0.7.1.tar.gz

Download URL cccpm-0.7.1.tar.gz
Size 140.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a5c05a2271add0235d56c7c52a5fe9064950e182c592ed81e03876cfb01649b8
BLAKE2b-256 checksum
How to use checksums
a3130714d43243f32695cabbb09b50fc017861c14e2d4925e79fc92d5e1c717d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 27, 2026.

Transparency log

Release files / cccpm-0.7.1-py3-none-any.whl

Download URL cccpm-0.7.1-py3-none-any.whl
Size 172.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6510f5968f10fbe0afe03a84d1a3fecab88c0c0173ad513dd0ae85992735296c
BLAKE2b-256 checksum
How to use checksums
8c09b45771cdd46b0c43ba3d77f63fb0939b033a5fe75a99cbc7e7d4317fc289
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 27, 2026.

Transparency log

Security for cccpm 0.7.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cccpm-0.7.1.tar.gz

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 Oct 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page