Bayesian networks and other Probabilistic Graphical Models.
Project description
pyAgrum
pyAgrum is a scientific C++ and Python library dedicated to Bayesian Networks and other Probabilistic Graphical Models. It provides a high-level interface to the part of aGrUM allowing to create, model, learn, use, calculate with and embed Bayesian Networks and other graphical models. Some specific (python and C++) codes are added in order to simplify and extend the aGrUM API.
Example
import pyAgrum as gum
# Creating BayesNet with 4 variables
bn=gum.BayesNet('WaterSprinkler')
print(bn)
# Adding nodes the long way
c=bn.add(gum.LabelizedVariable('c','cloudy ?',["Yes","No"]))
print(c)
# Adding nodes the short way
s, r, w = [ bn.add(name, 2) for name in "srw" ]
print (s,r,w)
print (bn)
# Addings arcs c -> s, c -> r, s -> w, r -> w
bn.addArc(c,s)
for link in [(c,r),(s,w),(r,w)]:
bn.addArc(*link)
print(bn)
# or, equivalenlty, creating the BN with 4 variables, and the arcs in one line
bn=gum.fastBN("w<-r<-c{Yes|No}->s->w")
# Filling CPTs
bn.cpt("c").fillWith([0.5,0.5])
bn.cpt("s")[0,:]=0.5 # equivalent to [0.5,0.5]
bn.cpt("s")[{"c":1}]=[0.9,0.1]
bn.cpt("w")[0,0,:] = [1, 0] # r=0,s=0
bn.cpt("w")[0,1,:] = [0.1, 0.9] # r=0,s=1
bn.cpt("w")[{"r":1,"s":0}] = [0.1, 0.9] # r=1,s=0
bn.cpt("w")[1,1,:] = [0.01, 0.99] # r=1,s=1
bn.cpt("r")[{"c":0}]=[0.8,0.2]
bn.cpt("r")[{"c":1}]=[0.2,0.8]
# Saving BN as a BIF file
gum.saveBN(bn,"WaterSprinkler.bif")
# Loading BN from a BIF file
bn2=gum.loadBN("WaterSprinkler.bif")
# Inference
ie=gum.LazyPropagation(bn)
ie.makeInference()
print (ie.posterior("w"))
# Adding hard evidence
ie.setEvidence({"s": 1, "c": 0})
ie.makeInference()
print(ie.posterior("w"))
# Adding soft and hard evidence
ie.setEvidence({"s": [0.5, 1], "c": 0})
ie.makeInference()
print(ie.posterior("w"))
LICENSE
Copyright (C) 2005-2024 by Pierre-Henri WUILLEMIN et Christophe GONZALES {prenom.nom}_at_lip6.fr
The aGrUM/pyAgrum library and all its derivatives are distributed under the LGPL3 license, see https://www.gnu.org/licenses/lgpl-3.0.en.html.
Maintainers
Lionel Torti
Gaspard Ducamp
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file pyAgrum-1.17.1-cp313-cp313-win_amd64.whl
.
File metadata
- Download URL: pyAgrum-1.17.1-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac5fd900a37d9e2b0c13e596808ec36df41be8f82ef48d751b53e40b5527feb9 |
|
MD5 | 1853b954e8908087fbeb5ec3a111fd38 |
|
BLAKE2b-256 | 9bc950d2fad9c6e08bc1dfb8ba1db9bee962578f5f332525770d7d7bfaef822d |
Provenance
File details
Details for the file pyAgrum-1.17.1-cp313-cp313-manylinux2014_x86_64.whl
.
File metadata
- Download URL: pyAgrum-1.17.1-cp313-cp313-manylinux2014_x86_64.whl
- Upload date:
- Size: 6.0 MB
- Tags: CPython 3.13
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 471c8d2c0cbd8e0b562650e6ef1d8b2b036b6439407ae6e669b695b6f55c38ff |
|
MD5 | 7fe9f459e9cb89a500855674e4215019 |
|
BLAKE2b-256 | 2094c9c69d46b16afd42b1b111587f3115fd5b57deec4ee2d36a4a899009cc34 |
Provenance
File details
Details for the file pyAgrum-1.17.1-cp313-cp313-manylinux2014_aarch64.whl
.
File metadata
- Download URL: pyAgrum-1.17.1-cp313-cp313-manylinux2014_aarch64.whl
- Upload date:
- Size: 5.5 MB
- Tags: CPython 3.13
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1ac1c9754c2242c953ae8f3abcf3e194fcb07b1ff019eee28d9522b6c162405 |
|
MD5 | 1a6e62dd74681eab01a3a0a2fc4f3bc9 |
|
BLAKE2b-256 | 6ba0469415ca74d2bcd7d1fd565a6e4872d668845bbcb3de1280781819bab2ed |
Provenance
File details
Details for the file pyAgrum-1.17.1-cp313-cp313-macosx_11_0_arm64.whl
.
File metadata
- Download URL: pyAgrum-1.17.1-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 4.3 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | facef082a1be7afb64f8f3ce7de474e3af43ad40f082a104e050daf661759e99 |
|
MD5 | 8b2e26414b159ab63bd65215bf467555 |
|
BLAKE2b-256 | a563278986d433ab6d9be53c1e4d53c83470a67a4833684a794ae740fb74b358 |
Provenance
File details
Details for the file pyAgrum-1.17.1-cp313-cp313-macosx_10_13_x86_64.whl
.
File metadata
- Download URL: pyAgrum-1.17.1-cp313-cp313-macosx_10_13_x86_64.whl
- Upload date:
- Size: 4.8 MB
- Tags: CPython 3.13, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54468395862f0afce03675a3edb30d996c9ce93248aa54b45b56844d4ba37652 |
|
MD5 | b4d348d8b61b644f64c01ad9881d0bbe |
|
BLAKE2b-256 | 5540b571c0e092d204862663d8d996fd9cd9aaafe6fa81cadb6abe295afe889c |
Provenance
File details
Details for the file pyAgrum-1.17.1-cp312-cp312-win_amd64.whl
.
File metadata
- Download URL: pyAgrum-1.17.1-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | deb23868dc85a487a1d528b1eaaeb489fc27a1278172a2ebae90b25f05227a24 |
|
MD5 | 16c66b6227333f5b64544760d2067f5a |
|
BLAKE2b-256 | 41530bfb0b0698e95f5ba95c8477092d471cc21a8c75e3248fc7dbe3d4d897e3 |
Provenance
File details
Details for the file pyAgrum-1.17.1-cp312-cp312-manylinux2014_x86_64.whl
.
File metadata
- Download URL: pyAgrum-1.17.1-cp312-cp312-manylinux2014_x86_64.whl
- Upload date:
- Size: 6.0 MB
- Tags: CPython 3.12
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 336c32ca58944cb84a2b8757fa4a851b6a564f4038a41db8958133f8f76a74ff |
|
MD5 | 5d4eaf33920bcd21ebbd5e8b5dbc7731 |
|
BLAKE2b-256 | f1063b34964af503823afd624317e505e88c659ac682d8c0c8baf11fe22bb312 |
Provenance
File details
Details for the file pyAgrum-1.17.1-cp312-cp312-manylinux2014_aarch64.whl
.
File metadata
- Download URL: pyAgrum-1.17.1-cp312-cp312-manylinux2014_aarch64.whl
- Upload date:
- Size: 5.5 MB
- Tags: CPython 3.12
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8dadd59c1ee4541d54585ae28e871a8b5eee537e84bda10f6a94e28521d93c9b |
|
MD5 | d24956cebd749669157e1e87b106bede |
|
BLAKE2b-256 | dd7f8f8ad5bae57250d14ad6079ed1f0d48377a2059d83a2df3b26f3f4713178 |
Provenance
File details
Details for the file pyAgrum-1.17.1-cp312-cp312-macosx_11_0_arm64.whl
.
File metadata
- Download URL: pyAgrum-1.17.1-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 4.3 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54c24b9fc7884e18059b812db83cfd957468755c95e6c60b220223f5277ac6ff |
|
MD5 | 7a8b5e4a03647653af85910983d3bac4 |
|
BLAKE2b-256 | 0f3364d24370a5ca38abb9c7e6c7916eadbcaa694e9810fe4edf26681ca5de7c |
Provenance
File details
Details for the file pyAgrum-1.17.1-cp312-cp312-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: pyAgrum-1.17.1-cp312-cp312-macosx_10_9_x86_64.whl
- Upload date:
- Size: 4.8 MB
- Tags: CPython 3.12, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c1a69646299ff219b93bf46b529f43420ab64a99a7fe8d54332f85b1eeefda6 |
|
MD5 | 44b1c9e9a10345752f598e3797500ed4 |
|
BLAKE2b-256 | 3413a86c9d6cfd84db069e03ef6d91772aae31b8474d9ce5a6df71810bbd10c8 |
Provenance
File details
Details for the file pyAgrum-1.17.1-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: pyAgrum-1.17.1-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e7a9bb3855cf29408147ed2bad6260bdba493a65569f85d670faa5b670958ac |
|
MD5 | b236796e2803e957a9d6209d8281d306 |
|
BLAKE2b-256 | 45211610c7abb9532ec23e12824f52b9d843d7e4b60b50b7561e4029a8ac2bd9 |
Provenance
File details
Details for the file pyAgrum-1.17.1-cp311-cp311-manylinux2014_x86_64.whl
.
File metadata
- Download URL: pyAgrum-1.17.1-cp311-cp311-manylinux2014_x86_64.whl
- Upload date:
- Size: 6.0 MB
- Tags: CPython 3.11
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f62b3fbee0e59dac2ff2c3b23f3c4b8b8e08a2021d84b471919643ad8095c895 |
|
MD5 | 2ada98f606639de124151541e930d72b |
|
BLAKE2b-256 | a21957f7569be5eb26fb6d03dd3a03c43749b3d6d18c7132f293fea975f8833f |
Provenance
File details
Details for the file pyAgrum-1.17.1-cp311-cp311-manylinux2014_aarch64.whl
.
File metadata
- Download URL: pyAgrum-1.17.1-cp311-cp311-manylinux2014_aarch64.whl
- Upload date:
- Size: 5.5 MB
- Tags: CPython 3.11
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fba88e2bd56abba37cae5762eb438b1c0d6558bad03bac333735f9e47b8e7f29 |
|
MD5 | 3ec3ea04ba6694a50279239ffc1b4377 |
|
BLAKE2b-256 | ce1b6066056dd8b75e72e510e380a3b5656014cdeb321489875cf3561862e53a |
Provenance
File details
Details for the file pyAgrum-1.17.1-cp311-cp311-macosx_11_0_arm64.whl
.
File metadata
- Download URL: pyAgrum-1.17.1-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 4.3 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0dc1dd81b9442238430873fd08bb14c2b26a6ce68504f862adfc3380d987d365 |
|
MD5 | 606ac5700cf90be5e83fbc243520284a |
|
BLAKE2b-256 | 5b64ea2ba7d5b2bd2356707782a504ac4ade5c8a7c39e980b0854257f7e9e85f |
Provenance
File details
Details for the file pyAgrum-1.17.1-cp311-cp311-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: pyAgrum-1.17.1-cp311-cp311-macosx_10_9_x86_64.whl
- Upload date:
- Size: 4.8 MB
- Tags: CPython 3.11, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 302f966df086b6948e8d03d9768617767a590456691e96967d1099eb8e3e7cb6 |
|
MD5 | c8929a42b3538156e4e03f28950d146e |
|
BLAKE2b-256 | 15f646b68f950ed0a0eb243ebaff9e74a4d0542cc4f3e3efc098dd3b04d8f4bf |
Provenance
File details
Details for the file pyAgrum-1.17.1-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: pyAgrum-1.17.1-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce3e62131173f1c626312ea138ad6d314724094c4d0867af36f1d62b291f5ed4 |
|
MD5 | d15d8ff0190a9b15abb245d6d0e65031 |
|
BLAKE2b-256 | f9ec088496348c712252f55b6493f2cf01bc03cf5f60d389be259cfa84d7e6fd |
Provenance
File details
Details for the file pyAgrum-1.17.1-cp310-cp310-manylinux2014_x86_64.whl
.
File metadata
- Download URL: pyAgrum-1.17.1-cp310-cp310-manylinux2014_x86_64.whl
- Upload date:
- Size: 6.0 MB
- Tags: CPython 3.10
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2143549bc19379eafa84633052b6239b6e741bd319ab6c350fdbe4418409346d |
|
MD5 | 912a8ea0baae754100a33fc2915e1874 |
|
BLAKE2b-256 | 23093a8314175dcc721166d5d697ed4582e57585065f88e7d62c69dd7b69ebba |
Provenance
File details
Details for the file pyAgrum-1.17.1-cp310-cp310-manylinux2014_aarch64.whl
.
File metadata
- Download URL: pyAgrum-1.17.1-cp310-cp310-manylinux2014_aarch64.whl
- Upload date:
- Size: 5.5 MB
- Tags: CPython 3.10
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f706129bcc190d8edf4c8ae93ec1259ac1dfa783d810cbdef7ceb2cfcb862f9 |
|
MD5 | afa15abaa33246700364d3746f781e0e |
|
BLAKE2b-256 | d76fbbc3e976508f645a7d156715db911630646192e0a82f18c990433e31b783 |
Provenance
File details
Details for the file pyAgrum-1.17.1-cp310-cp310-macosx_11_0_arm64.whl
.
File metadata
- Download URL: pyAgrum-1.17.1-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 4.3 MB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73f44c97b5c47530b885ef5e32c0e725d606bb6a1405b3fe66e63db16a90b2d6 |
|
MD5 | edefec9551583148481df9fd4da9bca4 |
|
BLAKE2b-256 | 844d3c6bdf0918b272f88598ce52c2fe0d5eda3945c2c219ed4f49c36f1abbed |
Provenance
File details
Details for the file pyAgrum-1.17.1-cp310-cp310-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: pyAgrum-1.17.1-cp310-cp310-macosx_10_9_x86_64.whl
- Upload date:
- Size: 4.8 MB
- Tags: CPython 3.10, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3371596efd52a31d055e1d35888b247a3f60da0d5f74c2602d7a5e7355762d81 |
|
MD5 | 2cea972b6ade70093345323b4e95af31 |
|
BLAKE2b-256 | 6551868e45677226e88ee0947c30f65fb89629a117f7a5134046894a1ebca9a2 |