Skip to content

Commit

Permalink
Merge pull request #275 from lnccbrown/fix-hddm-wfpt
Browse files Browse the repository at this point in the history
Set hddm-wfpt as required, separate dependency
  • Loading branch information
digicosmos86 authored Sep 8, 2023
2 parents 706d167 + 1471416 commit a064711
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 18 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,6 @@ jobs:

- name: Run tests
run: poetry run pytest

- name: build docs
run: poetry run mkdocs build
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,5 @@ site/

# folders in the repository
/notebooks

*.so
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
![GitHub Repo stars](https://img.shields.io/github/stars/lnccbrown/HSSM)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/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 <a href="https://ccbs.carney.brown.edu/brainstorm">BRAINSTORM</a> project in collaboration with the Center for Computation and Visualization and the Center for Computational Brain Science within the Carney Institute at Brown University.
Expand All @@ -28,7 +27,7 @@ HSSM is a Python toolbox that provides a seamless combination of state-of-the-ar
- 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](https://lnccbrown.github.io/HSSM/).
### [Official documentation](https://lnccbrown.github.io/HSSM/).

## Installation

Expand Down
9 changes: 9 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

## 0.1.x

### 0.1.5

We fixed the errors in v0.1.4. Sorry for the convenience! If you have accidentally
downloaded v0.1.4, please make sure that you update hssm to the current version.

- We made Cython dependencies of this package available via pypi. We have also built
wheels for (almost) all platforms so there is no need to build these Cython
dependencies.

### 0.1.4

- Added support of `blackbox` likelihoods for `ddm` and `ddm_sdv` models.
Expand Down
2 changes: 0 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ HSSM is a Python toolbox that provides a seamless combination of state-of-the-ar

**License**: HSSM is licensed under [Copyright 2023, Brown University, Providence, RI](../LICENSE)

**Version**: 0.1.4

- 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.
Expand Down
2 changes: 2 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ plugins:
- getting_started/getting_started.ipynb
- tutorials/main_tutorial.ipynb
- tutorials/likelihoods.ipynb
- .ipynb_checkpoints/*.ipynb
allow_errors: false
- mkdocstrings:
default_handler: python
handlers:
Expand Down
25 changes: 16 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[tool.poetry]
name = "HSSM"
version = "0.1.3"
description = ""
version = "0.1.5"
description = "Bayesian inference for hierarchical sequential sampling models."
authors = [
"Aisulu Omar <[email protected]>",
"Paul Xu <[email protected]>",
"Alexander Fengler <[email protected]>",
"Paul Xu <[email protected]>",
"Aisulu Omar <[email protected]>",
"Michael Frank <[email protected]>",
]
readme = "README.md"
Expand All @@ -16,8 +16,8 @@ keywords = ["HSSM", "sequential sampling models", "bayesian", "bayes", "mcmc"]

[tool.poetry.dependencies]
python = ">=3.9,<3.12"
pymc = ">=5.6.0,<5.7.0"
scipy = "1.10.1"
pymc = "^5.6.0"
arviz = "^0.14.0"
numpy = "^1.23.4"
onnx = "^1.12.0"
Expand All @@ -28,11 +28,11 @@ huggingface-hub = "^0.15.1"
onnxruntime = "^1.15.0"
bambi = "^0.12.0"
numpyro = "^0.12.1"
hddm-wfpt = {git = "https://github.com/brown-ccv/hddm-wfpt.git"}
hddm-wfpt = "^0.1.1"

[tool.poetry.group.dev.dependencies]
pytest = "^7.3.1"
black = {extras = ["jupyter"], version = "^23.7.0"}
black = { extras = ["jupyter"], version = "^23.7.0" }
mypy = "^1.4.1"
pre-commit = "^2.20.0"
jupyterlab = "^4.0.2"
Expand Down Expand Up @@ -162,7 +162,14 @@ ignore = [
"TID252",
]

exclude = [".github", "docs", "notebook", "tests"]
exclude = [
".github",
"docs",
"notebook",
"tests",
"src/hssm/likelihoods/hddm_wfpt/cdfdif_wrapper.c",
"src/hssm/likelihoods/hddm_wfpt/wfpt.cpp",
]

[tool.ruff.pydocstyle]
convention = "numpy"
Expand All @@ -171,5 +178,5 @@ convention = "numpy"
ignore_missing_imports = true

[build-system]
requires = ["poetry-core>=1.4.0"]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
3 changes: 2 additions & 1 deletion src/hssm/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""HSSM - Hierarchical Sequential Sampling Models."""

import importlib.metadata
import logging
import sys

Expand All @@ -17,7 +18,7 @@
handler = logging.StreamHandler(stream=sys.stdout)
_logger.addHandler(handler)

__version__ = "0.1.4"
__version__ = importlib.metadata.version(__package__ or __name__)

__all__ = [
"HSSM",
Expand Down
8 changes: 4 additions & 4 deletions src/hssm/likelihoods/blackbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from __future__ import annotations

import hddm_wfpt
import numpy as np
from hddm_wfpt import wfpt


def hddm_to_hssm(func):
Expand All @@ -30,7 +30,7 @@ def logp_ddm_bbox(data: np.ndarray, v, a, z, t) -> np.ndarray:
size = len(data)
zeros = np.zeros(size, dtype=np.float64)

return hddm_wfpt.wfpt.wiener_logp_array(
return wfpt.wiener_logp_array(
x=data,
v=v,
sv=zeros,
Expand All @@ -49,7 +49,7 @@ def logp_ddm_sdv_bbox(data: np.ndarray, v, a, z, t, sv) -> np.ndarray:
size = len(data)
zeros = np.zeros(size, dtype=np.float64)

return hddm_wfpt.wfpt.wiener_logp_array(
return wfpt.wiener_logp_array(
x=data,
v=v,
sv=sv,
Expand All @@ -65,7 +65,7 @@ def logp_ddm_sdv_bbox(data: np.ndarray, v, a, z, t, sv) -> np.ndarray:
@hddm_to_hssm
def logp_full_ddm(data: np.ndarray, v, a, z, t, sv, sz, st):
"""Compute blackbox log-likelihoods for full_ddm models."""
return hddm_wfpt.wfpt.wiener_logp_array(
return wfpt.wiener_logp_array(
x=data,
v=v,
sv=sv,
Expand Down

0 comments on commit a064711

Please sign in to comment.