cpm 0.26.0 is out: faster models, new tasks, and a new documentation site

We have released version v0.26.0 of cpm, the biggest update since the toolbox was first published. It brings large speed-ups across the board, two new built-in models, new datasets and examples, a rebuilt documentation site, and a long list of fixes. Upgrade with:

pip install --upgrade cpm-toolbox


Much faster fitting

Every part of the pipeline got quicker. The built-in applications (RLRW, HybridMBMF, PTSM and its variants) now compute all trials of a participant at once, which makes them 11 to 23 times faster in plain Python and 90 to 220 times faster with the optional numba backend. Install it with

pip install "cpm-toolbox[numba]"

The results are identical either way. Per-trial models built with the Wrapper are about twice as fast, the model components in cpm.models up to 17 times, and the likelihood functions 2.5 to 3 times.

Hierarchical fitting (EmpiricalBayes and VariationalBayes) got two new options, hessian=”finite_differences” and start=”prior_mean”, which together bring the cost per participant and iteration from about 20 ms down to about 7 ms, close to cbm. The defaults are unchanged, so existing scripts keep giving the same results for the same seed. If you want your own model to run this fast, the new SessionWrapper and a how-to guide show you how.

New models, datasets and examples

  • HybridMBMF, the hybrid model-based / model-free model of the two-step task (Kool et al., 2016; Smid et al., 2022), with a SARSA learning rule with eligibility traces to go with it.
    A two-step task example replicating Smid et al. (2022), with the data included.
  • A blocking example recreating Figures 1 and 2 of Spicer et al. (2021), fitting causal ratings, with the data included.
  • A new cpm.brainexplorer module that computes descriptive statistics and applies the exclusion criteria for the BrainExplorer games, plus two-step task data from Goblin Heist.
  • More informative optimisers

All optimisers now record how many starts a fit used and whether the initial guesses were supplied. Fits with priors return the log-likelihood and log-prior separately, and a new metrics argument lets you evaluate goodness-of-fit measures such as BIC at the optimum.

New documentation site

The documentation has been rebuilt with Sphinx, with a separate API reference, tutorials, examples and how-to guides. Links to the old pages redirect. Visit it at https://devcompsy.github.io/cpm/.

Fixes worth knowing about

This release fixes a number of bugs, some of which affect results. Hierarchical fits previously discarded the estimated population priors after the first evaluation, parallel fits with updated priors ignored those priors, and multi-start optimisers with three or more starts could keep a worse fit than the best one found. If you rely on any of these, your results might change, and we recommend rerunning them. Other fixes cover Bads under NumPy 2, FminBound on recent SciPy, Softmax overflow, uniform priors spanning the wrong range, and several errors in the diagnostics and the Simulator. The full list is in the changelog on GitHub.

cpm now requires Python 3.11 or later and is tested on Python 3.11 to 3.14.

As always, report problems and ideas on https://github.com/DevComPsy/cpm/issues.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *