Skip to content

lnccbrown/HSSM

Repository files navigation

HSSM - Hierarchical Sequential Sampling Modeling

Paper DOI PyPI Downloads GitHub stars Python Run tests Ruff License codecov

HSSM is a Python toolbox for hierarchical Bayesian neurocognitive modeling of choice, response time, and covariate-rich trial data.

It supports a broad family of sequential-sampling models, reinforcement learning sequential-sampling models (RLSSMs), behavioral, neural, eye-tracking, and SCR covariates, hierarchical regression, posterior diagnostics, posterior predictive checks, and Bayesian model comparison.

HSSM is a BRAINSTORM project in collaboration with the Center for Computation and Visualization and the Center for Computational Brain Science within the Carney Institute at Brown University.

At a Glance

Use HSSM to... What this means in practice
Fit sequential-sampling models Build DDM, LBA, race, angle, and related choice/RT models from a high-level Python API.
Model behavioral, neural, and other trial-wise covariates Regress model parameters on trial-level predictors such as EEG, eye-tracking, SCR, task condition, or stimulus features.
Use hierarchical and mixed-effects parameter models Estimate participant-level variation and within- or between-subject effects with Bambi-style formulas.
Work with RLSSMs Combine reinforcement-learning dynamics with sequential-sampling decision models.
Diagnose and compare Bayesian models Use ArviZ summaries, trace diagnostics, posterior predictive checks, and model-comparison workflows.
Extend models with custom likelihoods Register new models and likelihoods when built-in model definitions are not enough.

Installation

Install HSSM in a fresh virtual environment with Python 3.12, 3.13, or 3.14.

CPU

pip install hssm

You can also add HSSM to a uv project:

uv add hssm

CUDA

For NVIDIA GPUs, install HSSM with the extra matching your CUDA version:

pip install "hssm[cuda12]"  # CUDA 12
pip install "hssm[cuda13]"  # CUDA 13

or with uv:

uv add "hssm[cuda12]"  # CUDA 12
uv add "hssm[cuda13]"  # CUDA 13

Note: JAX's CUDA wheels are Linux-only and require a compatible NVIDIA driver (>= 525 for CUDA 12, >= 580 for CUDA 13).

Apple Silicon, AMD, and Other Accelerators

JAX supports several accelerator backends. Follow the official JAX installation guide for your platform, then install HSSM in the same environment.

Development Version

Install the current development version directly from GitHub:

pip install git+https://github.com/lnccbrown/HSSM.git

With uv:

uv add git+https://github.com/lnccbrown/HSSM.git

Google Colab

Google Colab already includes PyMC and JAX, so a standard pip install is enough:

!pip install hssm

Troubleshooting

HSSM is tested on Python 3.12, 3.13, and 3.14. If installation fails, start from a fresh virtual environment using one of those Python versions and check GitHub Discussions for known platform-specific fixes.

Quick Start

import arviz as az
import hssm

# Load a package-supplied choice/response-time dataset.
data = hssm.load_data("cavanagh_theta")

# Build a basic drift-diffusion model.
model = hssm.HSSM(data=data, model="ddm")

# Draw posterior samples. Increase draws/tune/chains for publication analyses.
idata = model.sample(draws=1000, tune=1000, chains=4)

# Inspect convergence and posterior summaries with ArviZ.
az.summary(idata)
az.plot_trace_dist(idata)

For diagnostics, interpretation, regression formulas, and model comparison, see the getting started guide and the main tutorial.

Where HSSM Fits

HSSM is the user-facing modeling layer in the HSSM ecosystem. It builds on PyMC for Bayesian inference, Bambi for formula-based and hierarchical regression, ArviZ for diagnostics and model comparison, and JAX/PyTensor for computation.

Within the broader ecosystem, ssm-simulators supplies simulator and model definitions, while LANfactory supports likelihood approximation workflows used to develop new likelihoods.

Citation

Please cite the current HSSM paper:

Fengler, A., Xu, Y., Bera, K., Paniagua, C., Omar, A., and Frank, M. J. HSSM: A Widely Applicable Toolbox for Hierarchical Bayesian Neurocognitive Modeling. bioRxiv 2026.06.05.730398.

Next Steps

Support

For questions, please open a discussion.

For bug reports and feature requests, please open an issue using the corresponding template.

Contribution

If you want to contribute to this project, please follow our contribution guidelines.

License

HSSM is licensed under Copyright 2023, Brown University, Providence, RI.

Acknowledgements

We are grateful to the Bambi project for inspiration, guidance, and support. Tomas Capretto, a key contributor to Bambi, provided invaluable assistance during HSSM development.

About

Development of HSSM package

Resources

License

Contributing

Stars

118 stars

Watchers

7 watching

Forks

Packages

 
 
 

Contributors