cpm: A Python Library for Theory-Driven Modelling in Computational Psychiatry

Lenard Dome, Frank H. Hezemans, Kenza Kadri, Ben J. Wagner, Andrew Webb, Tobias U. Hauser

PLOS Computational Biology, 22 (1--31). 2026. Journal article

https://doi.org/10.1371/journal.pcbi.1014481

The Computational Psychiatry Modelling (cpm) toolbox is a Python library for theory-driven modelling in computational psychiatry and cognitive (neuro-)science. cpm integrates a wide range of established computational approaches in a single framework. It is designed to be accessible to both expert and non-expert modellers in order to conduct cutting-edge computational modelling following the best practices of computational modelling and reporting. The toolbox provides a flexible and modular architecture that adjusts to different needs, and covers a wide range of tasks (such as risky decision-making, reward/punishment learning, perceptual metacognition), models (including those based on associative, reinforcement learning, and signal detection theories) and methods (such as hierarchical hyperparameter estimation using empirical and variational Bayesian techniques). The cpm toolbox thus provides the means for novices and experts in computational modelling alike to rapidly model their data and to adhere to best practices. We believe that building such an overarching, customisable tool can facilitate access to computational modelling and thus jumpstart computational approaches in psychiatry and beyond.