Skip to main content

No project description provided

Project description

HSSM - Hierarchical Sequential Sampling Modeling

PyPI PyPI - Downloads PyPI - Python Version GitHub pull requests GitHub Workflow Status (with event) GitHub Repo stars Code style: black

Overview

HSSM is a Python toolbox that provides a seamless combination of state-of-the-art likelihood approximation methods with the wider ecosystem of probabilistic programming languages. It facilitates flexible hierarchical model building and inference via modern MCMC samplers. HSSM is user-friendly and provides the ability to rigorously estimate the impact of neural and other trial-by-trial covariates through parameter-wise mixed-effects models for a large variety of cognitive process models. 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.

  • Allows approximate hierarchical Bayesian inference via various likelihood approximators.
  • Estimate impact of neural and other trial-by-trial covariates via native hierarchical mixed-regression support.
  • Extensible for users to add novel models with corresponding likelihoods.
  • Built on PyMC with support from the Python Bayesian ecosystem at large.
  • Incorporates Bambi's intuitive lmer-like regression parameter specification for within- and between-subject effects.
  • Native ArviZ support for plotting and other convenience functions to aid the Bayesian workflow.
  • Utilizes the ONNX format for translation of differentiable likelihood approximators across backends.

Official documentation link can be found here.

Installation

hssm is available through PyPI. You can install it with Pip via:

pip install hssm

You can also install the bleeding edge version of hssm directly from this repo:

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

You will need optional dependencies to use JAX-based samplers and graph the models. Please refer to our installation guide for more detailed instructions.

Note: Possible solutions to any issues with installations with hssm can be located here. We recommend leveraging an environment manager with Python 3.9~3.11 to prevent any problems with dependencies during the installation process. Please note that hssm is tested for python 3.9, 3.10, 3.11. Use other python versions with caution.

Example

Here is a simple example of how to use HSSM:

import hssm

# Set float type to float32 to avoid a current bug in PyMC
# This will not be necessary in the future
hssm.set_floatX("float32")

# Load a package-supplied dataset
cav_data = hssm.load_data('cavanagh_theta')

# Define a basic hierarchical model with trial-level covariates
model = hssm.HSSM(
    model="ddm",
    data=cav_data,
    include=[
        {
            "name": "v",
            "prior": {
                "Intercept": {"name": "Normal", "mu": 0.0, "sigma": 0.0},
                "theta": {"name": "Normal", "mu": 0.0, "sigma": 0.0},
            },
            "formula": "v ~ (1|participant_id) + theta",
            "link": "identity",
        },
    ],
)

# Sample from the posterior for this model
model.sample()

To quickly get started with HSSM, please follow this tutorial. For a deeper dive into HSSM, please follow our main tutorial.

License

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

Support

For questions, please feel free to open a discussion.

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

Contribution

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

Acknowledgements

We would like to extend our gratitude to the following individuals for their valuable contributions to the development of the HSSM package:

  • Bambi - A special thanks to the Bambi project for providing inspiration, guidance, and support throughout the development process. Tomás Capretto, a key contributor to Bambi, provided invaluable assistance in the development of the HSSM package.

Those contributions have greatly enhanced the functionality and quality of the HSSM.

Project details


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.1.4.tar.gz (350.2 kB view details)

Uploaded Source

Built Distributions

hssm-0.1.4-py3-none-any.whl (347.4 kB view details)

Uploaded Python 3

hssm-0.1.4-cp39-cp39-macosx_13_0_arm64.whl (361.0 kB view details)

Uploaded CPython 3.9 macOS 13.0+ ARM64

File details

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

File metadata

  • Download URL: hssm-0.1.4.tar.gz
  • Upload date:
  • Size: 350.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.9.13 Darwin/22.5.0

File hashes

Hashes for hssm-0.1.4.tar.gz
Algorithm Hash digest
SHA256 fb749dde17dd59952d3b5eeba3fb5b3b84bf809c31cd88a2a8584c0392ca1589
MD5 f1ae29e5f92d9c7d832bb7afbeeab0ba
BLAKE2b-256 825ac95e2802a5bb68543ca99e0297c887cd66bdc58b1e8c8f58b69505876cad

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hssm-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 347.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.9.13 Darwin/22.5.0

File hashes

Hashes for hssm-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0e20d5e9f45ad584ffda782df767a17145a408f3684326f8a70548cab84dff5a
MD5 9e05778097052a02ea86936c726f9901
BLAKE2b-256 115b2c3bb05b5209e73788d014723c8c55ba070eb18f12e3a9a9f8a57405101a

See more details on using hashes here.

File details

Details for the file hssm-0.1.4-cp39-cp39-macosx_13_0_arm64.whl.

File metadata

  • Download URL: hssm-0.1.4-cp39-cp39-macosx_13_0_arm64.whl
  • Upload date:
  • Size: 361.0 kB
  • Tags: CPython 3.9, macOS 13.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.9.13 Darwin/22.5.0

File hashes

Hashes for hssm-0.1.4-cp39-cp39-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 45c48bfb76ac562b4c2cb8c391f48eb2bcf2815c7ca8b5f44724690c2043f0ab
MD5 cdc0fb3139942c04530d1bdc36cec04a
BLAKE2b-256 725526618e8f87fba9b0b2705870c4e250a44359177d3093c2f7ec80fd051cd7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page