Skip to content

Commit

Permalink
Merge pull request #17 from wd60622/relax-env
Browse files Browse the repository at this point in the history
relax environment and tox
  • Loading branch information
wd60622 authored Jan 1, 2024
2 parents 2c46cea + 83a5b64 commit 96fbcfa
Show file tree
Hide file tree
Showing 8 changed files with 1,177 additions and 788 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: docs
name: Docs
on:
push:
branches:
Expand All @@ -17,4 +17,4 @@ jobs:
with:
python-version: 3.9
- run: pip install mkdocs mkdocs-material mkdocs-markdownextradata-plugin mkdocs-git-revision-date-localized-plugin "mkdocstrings[python]"
- run: mkdocs gh-deploy --force
- run: mkdocs gh-deploy --force
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Python package
name: Publish Python Package
on:
push:
tags:
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Tests

on:
- push
- pull_request

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Test with tox
run: tox
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# conjugate priors
# Conjugate Models
![Tests](https://github.com/wd60622/conjugate/actions/workflows/tests.yml/badge.svg) [![PyPI version](https://badge.fury.io/py/conjugate-models.svg)](https://badge.fury.io/py/conjugate-models) [![docs](https://github.com/wd60622/conjugate/actions/workflows/docs.yml/badge.svg)](https://github.com/wd60622/conjugate/actions/workflows/docs.yml)

Bayesian conjugate models in Python


Expand Down Expand Up @@ -48,4 +50,4 @@ plt.show()

<img height=400 src="docs/images/binomial-beta.png" title="Binomial Beta Comparison">

More examples on in the [documentation](https://wd60622.github.io/conjugate/).
More examples on in the [documentation](https://wd60622.github.io/conjugate/).
3 changes: 2 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ hide:
- navigation
---
# Conjugate Models
![Tests](https://github.com/wd60622/conjugate/actions/workflows/tests.yml/badge.svg) [![PyPI version](https://badge.fury.io/py/conjugate-models.svg)](https://badge.fury.io/py/conjugate-models) [![docs](https://github.com/wd60622/conjugate/actions/workflows/docs.yml/badge.svg)](https://github.com/wd60622/conjugate/actions/workflows/docs.yml)

Bayesian conjugate models in Python

Expand Down Expand Up @@ -125,4 +126,4 @@ p = sigmoid(p_raw)

## Resources

- [Conjugate Priors](https://en.wikipedia.org/wiki/Conjugate_prior)
- [Conjugate Priors](https://en.wikipedia.org/wiki/Conjugate_prior)
1,888 changes: 1,110 additions & 778 deletions poetry.lock

Large diffs are not rendered by default.

29 changes: 25 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "conjugate-models"
version = "0.2.0"
version = "0.3.0"
description = "Bayesian Conjugate Models in Python"
authors = ["Will Dean <wd60622@gmail.com>"]
license = "MIT"
Expand All @@ -26,10 +26,10 @@ classifiers = [

[tool.poetry.dependencies]
python = ">=3.8,<4.0"
matplotlib = "^3.6.2"
numpy = "^1.24.3"
matplotlib = "*"
numpy = "*"
pandas = "*"
scipy = "<1.10.0"
scipy = "*"


[tool.poetry.group.dev.dependencies]
Expand All @@ -39,13 +39,34 @@ pypika = "^0.48.9"
pymc = "^5.5.0"
black = "^23.3.0"
ipython = "8.8.0"
scikit-learn = "^1.3.2"
tox = "^4.11.4"


[tool.poetry.group.docs.dependencies]
mkdocs = "^1.4.3"
mkdocs-material = "^9.1.17"
mkdocstrings = {extras = ["python"], version = "^0.22.0"}

[tool.tox]
legacy_tox_ini = """
[tox]
min_version = 4.0
isolated_build = true
env_list =
py312
py311
py310
py39
py38
[testenv]
deps =
pytest
pypika
commands = pytest tests
"""

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
7 changes: 7 additions & 0 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
NegativeBinomial,
Poisson,
NormalInverseGamma,
MultivariateStudentT,
)
from conjugate.models import (
get_binomial_beta_posterior_params,
Expand All @@ -26,6 +27,7 @@
poisson_gamma_posterior_predictive,
get_exponential_gamma_posterior_params,
linear_regression,
linear_regression_posterior_predictive,
)


Expand Down Expand Up @@ -237,3 +239,8 @@ def between(x, lower, upper):
assert between(intercept, *np.quantile(beta_samples[:, 0], q=q))
assert between(slope, *np.quantile(beta_samples[:, 1], q=q))
assert between(sigma, *np.quantile(sigma_samples, q=q))

posterior_predictive = linear_regression_posterior_predictive(
normal_inverse_gamma=posterior, X=X
)
assert isinstance(posterior_predictive, MultivariateStudentT)

0 comments on commit 96fbcfa

Please sign in to comment.