diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 7fb6fff4..293c3f94 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -51,3 +51,6 @@ jobs: - name: Run tests run: poetry run pytest + + - name: build docs + run: poetry run mkdocs build diff --git a/.gitignore b/.gitignore index 4815c96b..c545c0e7 100644 --- a/.gitignore +++ b/.gitignore @@ -70,3 +70,5 @@ site/ # folders in the repository /notebooks + +*.so diff --git a/README.md b/README.md index f13aeff8..6b04d60b 100644 --- a/README.md +++ b/README.md @@ -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 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. @@ -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 diff --git a/docs/changelog.md b/docs/changelog.md index 770a03f9..d641dcc2 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -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. diff --git a/docs/index.md b/docs/index.md index 63d4508b..f95722de 100644 --- a/docs/index.md +++ b/docs/index.md @@ -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. diff --git a/mkdocs.yml b/mkdocs.yml index 6bed7798..d2ada41b 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -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: diff --git a/pyproject.toml b/pyproject.toml index 54d20618..b4b8bdaa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 ", - "Paul Xu ", "Alexander Fengler ", + "Paul Xu ", + "Aisulu Omar ", "Michael Frank ", ] readme = "README.md" @@ -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" @@ -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" @@ -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" @@ -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" diff --git a/src/hssm/__init__.py b/src/hssm/__init__.py index 3d8b6f64..382d3a8d 100644 --- a/src/hssm/__init__.py +++ b/src/hssm/__init__.py @@ -1,5 +1,6 @@ """HSSM - Hierarchical Sequential Sampling Models.""" +import importlib.metadata import logging import sys @@ -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", diff --git a/src/hssm/likelihoods/blackbox.py b/src/hssm/likelihoods/blackbox.py index 1712c1d7..d68e9a07 100644 --- a/src/hssm/likelihoods/blackbox.py +++ b/src/hssm/likelihoods/blackbox.py @@ -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): @@ -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, @@ -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, @@ -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,