https://github.com/bkbilly/bayesian_networks
Implementation for bayesian network
https://github.com/bkbilly/bayesian_networks
bayesian-network enumeration likelihood-weighting pipy rejection-sampling
Last synced: 14 days ago
JSON representation
Implementation for bayesian network
- Host: GitHub
- URL: https://github.com/bkbilly/bayesian_networks
- Owner: bkbilly
- Created: 2019-11-16T21:40:02.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-09T00:02:31.000Z (about 6 years ago)
- Last Synced: 2026-01-03T02:10:30.315Z (2 months ago)
- Topics: bayesian-network, enumeration, likelihood-weighting, pipy, rejection-sampling
- Language: Python
- Homepage: https://pypi.org/project/bayesian-networks
- Size: 23.4 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Bayesian Networks
[](https://pypi.org/project/bayesian-networks/)
Implementation for bayesian network with
- Enumeration
- Rejection Sampling
- Likelihood Weighting
## Install
```bash
sudo pip3 install --upgrade bayesian-networks
```
## How to use
```python
import bayesian_networks
testcase = {
'netid': "burglary",
'query': ('B', 'j,m'),
'result': {True: 0.28, False: 0.72},
'samples': 10000,
}
enum = bayesian_networks.Enumeration()
results = enum.run(testcase)
bayesian_networks.print_result(results, showcolors=True)
rejection = bayesian_networks.RejectionSampling()
results = rejection.run(testcase)
bayesian_networks.print_result(results, showcolors=True)
weighting = bayesian_networks.LikelihoodWeighting()
results = weighting.run(testcase)
bayesian_networks.print_result(results, showcolors=True)
```