cpm Unifies Theory-Driven Modelling for Computational Psychiatry
A peer-reviewed PLOS Computational Biology paper introduces cpm, an open-source Python toolbox for theory-driven modelling in computational psychiatry and cognitive neuroscience. The library brings model definition, parameter estimation, hierarchical inference, simulation, recovery analysis, and tabular reporting into a modular workflow. Its current examples cover reinforcement learning, risky decision-making, metacognition, and related trial-level models. The project aims to reduce duplicated implementations and make advanced methods more accessible to clinicians and researchers with less programming experience. LDS sees the main value in workflow standardization and inspectable model assumptions, not automatic scientific validity. Researchers still need task-specific model checks, parameter and model recovery, sensitivity analysis, version pinning, and external replication before drawing clinical conclusions from fitted latent variables.
What happened
A PLOS Computational Biology paper presents cpm, an open-source Python library for theory-driven computational modelling in psychiatry, psychology, and cognitive neuroscience. The toolbox is designed to give researchers a consistent path from trial-level model definition through fitting, hierarchical estimation, simulation, recovery checks, comparison, and structured outputs. Source code, documentation, tutorials, and accompanying simulations are publicly available.
Technical context
cpm uses a modular interface in which a model maps trial-level inputs to predictions and latent states. The paper demonstrates model families used for reinforcement learning, prospect-theoretic decision-making, and metacognitive analysis. Optimization utilities support parameter estimation with bounds and priors, while hierarchical modules can estimate group-level prior structure. Simulation tools support parameter recovery and model recovery, which are essential checks before interpreting fitted parameters.
| Workflow stage | cpm role | Researcher responsibility |
|---|---|---|
| Model definition | Standard trial-level interface | State assumptions and alternatives |
| Estimation | Optimization and hierarchical tools | Inspect convergence and identifiability |
| Simulation | Generate behavior from fitted models | Test parameter and model recovery |
| Comparison | Organize fit metrics and outputs | Avoid choosing by one metric alone |
| Reporting | Structured tabular results | Pin versions and preserve provenance |
Background
Computational psychiatry often depends on custom code that differs across laboratories even when researchers intend to implement the same theory. A shared interface can make assumptions easier to inspect, reduce repeated engineering, and help training. It can also make analysis recipes easier to reproduce because model construction, estimation, simulation, and reporting live in one documented environment.
The library does not remove the scientific burden from the user. A convenient implementation can still encode the wrong theory, fit weakly identified parameters, or produce stable-looking estimates from an unsuitable task. Clinical interpretation is especially sensitive because latent variables are model-dependent abstractions, not direct measurements of a disorder or mechanism.
Editorial analysis
The practical adoption test is not whether cpm can fit a dataset. It is whether a complete analysis remains reproducible under a pinned environment, recovers known simulated parameters, distinguishes plausible competing models, and produces stable conclusions across reasonable priors and optimization settings. Teams should preserve the exact library version, model code, task transformation, random seeds, diagnostics, and comparison rules with every result.
What to watch
Watch for independent replications, broader model coverage, performance on larger datasets, interoperability with existing behavioral workflows, and evidence that the common interface reduces implementation divergence across laboratories without hiding important theoretical choices.
Key Points
- 1cpm combines model definition, estimation, hierarchical inference, simulation, recovery analysis, and reporting in one open-source Python workflow.
- 2The shared interface may reduce duplicated implementations, but it cannot replace identifiability checks, sensitivity analysis, or independent replication.
- 3LDS recommends pinned environments, recovery studies, competing-model tests, and complete provenance before interpreting fitted variables clinically.
Scoring Rationale
An impact score of 6.4 reflects useful open-source standardization for a specialized research field, tempered by limited independent adoption and validation evidence.
Sources
Primary source and supporting public references used for this report.
Practice interview problems based on real data
1,625 SQL & Python problems across 15 industry datasets — the exact type of data you work with.
Try 250 free problems

