This is the Python version of hBayesDM (hierarchical Bayesian modeling of Decision-Making tasks), a user-friendly package that offers hierarchical Bayesian analysis of various computational models on an array of decision-making tasks. hBayesDM in Python uses cmdstanpy (the Python interface to CmdStan) for Bayesian inference.
Requires Python ≥ 3.13 and depends on NumPy, SciPy, Pandas, cmdstanpy, Matplotlib, and ArviZ (≥ 1.0).
- Documentation: http://hbayesdm.readthedocs.io/
Install hBayesDM and its Python dependencies, then install CmdStan itself:
pip install hbayesdm
python -c "import cmdstanpy; cmdstanpy.install_cmdstan()"Or, if you use uv:
uv add hbayesdm
uv run python -c "import cmdstanpy; cmdstanpy.install_cmdstan()"For the development version:
pip install "git+https://github.com/CCS-Lab/hBayesDM.git@develop#egg=hbayesdm&subdirectory=Python"Each Stan model compiles on first use (~30 s) and cmdstanpy caches the
binary alongside the .stan file for subsequent fits.
If you used hBayesDM or some of its codes for your research, please cite this paper:
@article{hBayesDM,
title = {Revealing Neurocomputational Mechanisms of Reinforcement Learning and Decision-Making With the {hBayesDM} Package},
author = {Ahn, Woo-Young and Haines, Nathaniel and Zhang, Lei},
journal = {Computational Psychiatry},
year = {2017},
volume = {1},
pages = {24--57},
publisher = {MIT Press},
url = {doi:10.1162/CPSY_a_00002},
}