BayNet
BayNet is a Python library for generating, sampling data from, comparing, and visualising Bayesian Networks.
Installation
pip install BayNet
Usage
Generate a 10-node Forest Fire DAG, and parameters, then sample data from it:
from baynet import DAG
dag = DAG.generate("forest fire", 10, seed=1) # Creates a DAG
dag.generate_discrete_parameters(alpha=5.0, min_levels=3, max_levels=5, seed=1) # Generates parameters
data = dag.sample(1_000) # Samples data, returning a pandas DataFrame
Generate a 5-node Barabasi-Albert (preferential attachment) graph and plot it:
from baynet import DAG
DAG.generate("barabasi albert", 5, seed=1).plot() # Saves 'DAG.png' in working directory
Generate two 5-node Erdos-Renyi DAGs and compare them:
from baynet import DAG, metrics
dag_1 = DAG.generate("erdos_renyi", 5,seed=1)
dag_2 = DAG.generate("erdos_renyi", 5)
print(metrics.shd(dag_1, dag_2)) # prints DAG SHD, in this case 3
print(metrics.shd(dag_1, dag_2, skeleton=True)) # prints skeleton SHD, in this case 3
dag_1.compare(dag_2).plot() # saves 'comparison.png' in working directory
Taking dag_1 to be the ground truth and dag_2 to be a structure learning result:
- Dashed red arcs represent false negatives
- Blue arcs are represent positives
- Green arcs represent incorrectly directed arcs
Metadata
Release files for BayNet 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| BayNet-0.3.0.tar.gz | 1.2 MB | Without provenance | Details for BayNet-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| BayNet-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for BayNet-0.3.0-py3-none-any.whl |
Total release size: 2.5 MB
Release files / BayNet-0.3.0.tar.gz
| Download URL | BayNet-0.3.0.tar.gz |
|---|---|
| Size | 1.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
51d4a6d2460043ad24632808fa614f106d727ad55b3f18e618bc2927f358ab7c
|
|
BLAKE2b-256 checksum How to use checksums |
256d1439c08cd497f3affe4dc6ad6ae8321c35f8511cf3df17f045dffbeda583
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/46.1.1.post20200323 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.7
|
Release files / BayNet-0.3.0-py3-none-any.whl
| Download URL | BayNet-0.3.0-py3-none-any.whl |
|---|---|
| Size | 1.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
308924f8d7aa339328ddbce90ea224bf2fa72acbcb3f4a0827b917e3b03504eb
|
|
BLAKE2b-256 checksum How to use checksums |
94db92ba29160830bfa070a6fd36f624a63b12b0981b97102c84498387d3ef55
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/46.1.1.post20200323 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.7
|
Security for BayNet 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.