Skip to main content

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hssm-0.4.0.tar.gz (296.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hssm-0.4.0-py3-none-any.whl (338.7 kB view details)

Uploaded Python 3

File details

Details for the file hssm-0.4.0.tar.gz.

File metadata

  • Download URL: hssm-0.4.0.tar.gz
  • Upload date:
  • Size: 296.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for hssm-0.4.0.tar.gz
Algorithm Hash digest
SHA256 d8ff7d4bfe91691a6666d09bc480ff7bd4c4fa786ff5eb4bb00c4e6d3d23667d
MD5 b19b702df64901942d157c730b6ad175
BLAKE2b-256 97055ae6412d869437aab875cc1b42a06f9e8be0557e061e0e0fca0e0200d1d3

See more details on using hashes here.

File details

Details for the file hssm-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: hssm-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 338.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for hssm-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 de560429625b20b862f7d39bbdc6daea9987de8ad73be5a36586414249a72d4b
MD5 4cc1434f78a174a77b558454511365e0
BLAKE2b-256 085b4ba0b8311ad3fe9309d4d714344076be7318e59c3bbc83b3de65095079d1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page