Skip to main content

Confound-Corrected Connectome-based Predictive Modeling Python Package

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cccpm-0.4.1.tar.gz (85.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cccpm-0.4.1-py3-none-any.whl (96.8 kB view details)

Uploaded Python 3

File details

Details for the file cccpm-0.4.1.tar.gz.

File metadata

  • Download URL: cccpm-0.4.1.tar.gz
  • Upload date:
  • Size: 85.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cccpm-0.4.1.tar.gz
Algorithm Hash digest
SHA256 0c36b98dd5e20fc2b97e4a2a826339a4bdcc42558bf588e1c580b11e789a88af
MD5 25e0aa844d391f564bf5023490bf7410
BLAKE2b-256 da23d2bc33f804e045ebe5893167a2ca99f6178d00c381b0fcb0d7f15e101512

See more details on using hashes here.

Provenance

The following attestation bundles were made for cccpm-0.4.1.tar.gz:

Publisher: publish.yml on wwu-mmll/confound_corrected_cpm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cccpm-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: cccpm-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 96.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cccpm-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c6977567d099edfa7202ca46c5d545398112556d3917a07f9bee83677498ec1a
MD5 3a504255504c3fbdf17097bc64a70f1d
BLAKE2b-256 1d56cf34bd3f2962cf98b1c510cbf98b35f9dc2c9ee380c270ba46b3a1f817c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for cccpm-0.4.1-py3-none-any.whl:

Publisher: publish.yml on wwu-mmll/confound_corrected_cpm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page