https://github.com/roma-glushko/posterior
๐ฒ A lightweight framework for Bayes inference.
https://github.com/roma-glushko/posterior
bayesian-inference data-science framework statistics
Last synced: 3 months ago
JSON representation
๐ฒ A lightweight framework for Bayes inference.
- Host: GitHub
- URL: https://github.com/roma-glushko/posterior
- Owner: roma-glushko
- Created: 2021-03-27T21:00:23.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-11-03T19:40:33.000Z (almost 4 years ago)
- Last Synced: 2025-04-06T06:30:49.166Z (7 months ago)
- Topics: bayesian-inference, data-science, framework, statistics
- Language: Python
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Posterior
A lightweight framework for Bayes's inference.
## Usage
```python
"""
Problem:
There are two bowls of cookies.
Bowl 1 contains 30 vanilla cookies and 10 chocolate cookies.
Bowl 2 contains 20 of each.
You choose one of the bowls at random and, without looking, then select a cookie at random.
The cookie is vanilla.
What is the probability that it came from Bowl 1?
"""from posterior.hypotheses import Hypotheses
cookie_likelihood = {
"bowl1": {
"chocolate": 1 / 4,
"vanilla": 3 / 4
},
"bowl2": {
"chocolate": 1 / 2,
"vanilla": 1 / 2,
},
}hypotheses = Hypotheses(["bowl1", "bowl2"], likelihood=cookie_likelihood)
hypotheses.evaluate("vanilla")print(hypotheses)
```Output:
```bash
โโโโโโโโโโโโโโคโโโโโโโโโโโโโโโโโโ
โ Outcomes โ Probabilities โ
โโโโโโโโโโโโโโชโโโโโโโโโโโโโโโโโโก
โ bowl1 โ 0.6 โ
โโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโค
โ bowl2 โ 0.4 โ
โโโโโโโโโโโโโโงโโโโโโโโโโโโโโโโโโ
```