https://github.com/aesara-devs/aeppl
Tools for an Aesara-based PPL.
Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
1 of 14 committers (7.1%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.0%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
Tools for an Aesara-based PPL.
Basic Info
- Host: GitHub
- Owner: aesara-devs
- License: mit
- Language: Python
- Default Branch: main
- Homepage: https://aeppl.readthedocs.io
- Size: 736 KB
Statistics
- Stars: 66
- Watchers: 2
- Forks: 20
- Open Issues: 44
- Releases: 46
Topics
Metadata Files
README.md
# AePPL
[![Pypi][pypi-badge]][pypi]
[![Downloads][downloads-badge]][releases]
[![Contributors][contributors-badge]][contributors]
[![Gitter][gitter-badge]][gitter]
[![Discord][discord-badge]][discord]
[![Twitter][twitter-badge]][twitter]
Aeppl provides tools for a[e]PPL written in [Aesara](https://github.com/aesara-devs/aesara).
*Build arbitrarily complex probabilistic models. If it is mathematically defined, AePPL will support it.*
[Features](#features) •
[Get started](#get-started) •
[Install](#install) •
[Get help](#get-help) •
[Contribute](#contribute)
Features
- Convert graphs containing Aesara
RandomVariables into joint log-probability graphs - Transforms for
RandomVariables that map constrained support spaces to unconstrained spaces (e.g. the extended real numbers), and a rewrite that automatically applies these transformations throughout a graph - Tools for traversing and transforming graphs containing
RandomVariables RandomVariable-aware pretty printing and LaTeX output
Get started
Using aeppl, one can create a joint log-density graph from a graph
containing Aesara RandomVariables:
``` python import aesara from aesara import tensor as at
from aeppl import joint_logprob, pprint
srng = at.random.RandomStream()
A simple scale mixture model
Srv = srng.invgamma(0.5, 0.5) Yrv = srng.normal(0.0, at.sqrt(S_rv))
Compute the joint log-probability
logprob, (y, s) = jointlogprob(Yrv, S_rv) ```
Log-density graphs are standard Aesara graphs, so we can compute compile them to compute values:
``` python logprob_fn = aesara.function([y, s], logprob)
logprob_fn(-0.5, 1.0)
array(-2.46287705)
```
AePPL provides utilities to pretty-print the log-density graphs:
``` python from aeppl import pprint, latex_pprint
Print the original graph
print(pprint(Y_rv))
b ~ invgamma(0.5, 0.5) in R, a ~ N(0.0, sqrt(b)**2) in R
a
print(latexpprint(Yrv))
\begin{equation}
\begin{gathered}
b \sim \operatorname{invgamma}\left(0.5, 0.5\right)\, \in \mathbb{R}
\
a \sim \operatorname{N}\left(0.0, {\sqrt{b}}^{2}\right)\, \in \mathbb{R}
\end{gathered}
\
a
\end{equation}
Simplify the graph so that it's easier to read
from aesara.graph.rewriting.utils import rewritegraph from aesara.tensor.rewriting.basic import topoconstant_folding
logprob = rewritegraph(logprob, customrewrite=topoconstantfolding)
print(pprint(logprob))
s in R, y in R
(switch(s >= 0.0,
((-0.9189385175704956 +
switch(s == 0, -inf, (-1.5 * log(s)))) - (0.5 / s)),
-inf) +
((-0.9189385332046727 + (-0.5 * ((y / sqrt(s)) ** 2))) - log(sqrt(s))))
```
Joint log-densities can be computed for some terms that are derived from
RandomVariables, as well:
``` python
Create a switching model from a Bernoulli distributed index
Zrv = srng.normal([-100, 100], 1.0, name="Z") Irv = srng.bernoulli(0.5, name="I")
Mrv = Zrv[Irv] Mrv.name = "M"
Compute the joint log-probability for the mixture
logprob, (m, z, i) = jointlogprob(Mrv, Zrv, Irv)
logprob = rewritegraph(logprob, customrewrite=topoconstantfolding)
print(pprint(logprob))
i in Z, m in R, a in Z
(switch((0 <= i and i <= 1), -0.6931472, -inf) +
((-0.9189385332046727 + (-0.5 * (((m - [-100 100][a]) / [1. 1.][a]) ** 2))) -
log([1. 1.][a])))
```
Take a look at the documentation for more examples.
Install
The latest release of aeppl can be installed from PyPI using pip:
bash
pip install aeppl
Or via conda-forge:
bash
conda install -c conda-forge aeppl
The nightly (bleeding edge) version of aeppl can be installed using pip:
bash
pip install aeppl-nightly
Get help
Report bugs by opening an issue. If you have a question regarding the usage of AePPL, start a discussion or visit our Discord server and Gitter room chats.
Contribute
AePPL welcomes contributions. To start contributing, take a look at the open issues.
If you want to implement a new feature, open a discussion or come chat with us on Discord or Gitter.
Owner
- Name: Aesara
- Login: aesara-devs
- Kind: organization
- Email: aesara.devs@gmail.com
- Website: https://github.com/aesara-devs
- Twitter: AesaraDevs
- Repositories: 7
- Profile: https://github.com/aesara-devs
GitHub Events
Total
- Watch event: 2
- Push event: 2
Last Year
- Watch event: 2
- Push event: 2
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Brandon T. Willard | b****d | 155 |
| Ricardo | r****4@g****m | 55 |
| Rémi Louf | r****f@g****m | 26 |
| Larry Dong | l****g@m****a | 7 |
| lucianopaz | l****o@g****m | 1 |
| kees ter brugge | k****e@g****m | 1 |
| kc611 | c****6@g****m | 1 |
| The Gitter Badger | b****r@g****m | 1 |
| Oriol (ZBook) | o****a@g****m | 1 |
| LeoKnaw | 4****w | 1 |
| Kd-Here | 9****e | 1 |
| Daniel Gerlanc | d****n@g****m | 1 |
| Ben Mares | s****1@t****m | 1 |
| Adrian Seyboldt | a****t@g****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 7 months ago
All Time
- Total issues: 89
- Total pull requests: 103
- Average time to close issues: 4 months
- Average time to close pull requests: 26 days
- Total issue authors: 8
- Total pull request authors: 9
- Average comments per issue: 2.38
- Average comments per pull request: 3.16
- Merged pull requests: 83
- Bot issues: 0
- Bot pull requests: 6
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- rlouf (16)
- ricardoV94 (12)
- brandonwillard (11)
- larryshamalama (3)
- junpenglao (2)
- aseyboldt (1)
- bwengals (1)
- MauricioGS99 (1)
Pull Request Authors
- brandonwillard (25)
- ricardoV94 (11)
- rlouf (10)
- larryshamalama (4)
- github-actions[bot] (2)
- dependabot[bot] (2)
- LeoKnaw (1)
- Kd-Here (1)
- dgerlanc (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 4
-
Total downloads:
- pypi 182,831 last-month
- Total docker downloads: 10
-
Total dependent packages: 11
(may contain duplicates) -
Total dependent repositories: 105
(may contain duplicates) - Total versions: 867
- Total maintainers: 3
pypi.org: aeppl
PPL tools for Aesara
- Homepage: https://github.com/aesara-devs/aeppl
- Documentation: https://aeppl.readthedocs.io/
- License: MIT License
-
Latest release: 0.1.5
published over 2 years ago
Rankings
Maintainers (3)
pypi.org: aeppl-nightly
PPL tools for Aesara
- Homepage: https://github.com/aesara-devs/aeppl
- Documentation: https://aeppl-nightly.readthedocs.io/
- License: MIT License
-
Latest release: 0.0.40
published about 3 years ago
Rankings
Maintainers (3)
conda-forge.org: aeppl
- Homepage: https://github.com/aesara-devs/aeppl
- License: MIT
-
Latest release: 0.0.39
published over 3 years ago
Rankings
conda-forge.org: aeppl-base
- Homepage: https://github.com/aesara-devs/aeppl
- License: MIT
-
Latest release: 0.0.39
published over 3 years ago
Rankings
Dependencies
- actions/checkout v3 composite
- actions/setup-python v4 composite
- pypa/gh-action-pypi-publish release/v1 composite
- actions/checkout v3 composite
- actions/download-artifact v2 composite
- actions/setup-python v4 composite
- actions/upload-artifact v2 composite
- pypa/gh-action-pypi-publish release/v1 composite
- actions/checkout v3 composite
- actions/download-artifact v2 composite
- actions/setup-python v4 composite
- actions/upload-artifact v2 composite
- codecov/codecov-action v1 composite
- conda-incubator/setup-miniconda v2 composite
- dorny/paths-filter v2 composite
- pre-commit/action v3.0.0 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- browniebroke/pre-commit-autoupdate-action main composite
- peter-evans/create-pull-request v4 composite
- jinja2 <3.1.0
- sphinx *
- sphinx-autodoc-typehints *
- sphinx-book-theme >=0.3.3
- sphinx-copybutton *
- sphinx-design *
- autoflake *
- black ==20.8b1
- coveralls *
- diff-cover *
- numdifftools *
- pre-commit *
- pydocstyle >=3.0.0
- pylint >=2.3.1
- pytest >=5.0.0
- pytest-cov >=2.6.1
- pytest-html >=1.20.0
- versioneer *
- aesara >=2.8.13
- numpy >=1.18.1
- scipy >=1.4.0
- typing_extensions *