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_nightly-1.16.0.dev202410101727562243-cp312-cp312-win_amd64.whl
.
File metadata
- Download URL: pyAgrum_nightly-1.16.0.dev202410101727562243-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/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/39.0.1 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.15rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20af358c7ab86ff428279cac9413b0fa27c222638ffc4ce4fd50ba396573091c |
|
MD5 | f76249282a9aa62ed15a82b123d7e18c |
|
BLAKE2b-256 | 11d2bed0b40c59154edb036bb0efb8634527d3af8916f4c27e3e525c0ed005fd |
File details
Details for the file pyAgrum_nightly-1.16.0.dev202410101727562243-cp312-cp312-manylinux2014_x86_64.whl
.
File metadata
- Download URL: pyAgrum_nightly-1.16.0.dev202410101727562243-cp312-cp312-manylinux2014_x86_64.whl
- Upload date:
- Size: 6.0 MB
- Tags: CPython 3.12
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/39.0.1 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.15rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08f04691ea60f9bdfd2ed9902389b87b26525bdb19efc7232bd50c2b3ebfc73b |
|
MD5 | 5f40b0e500db64699483dfd7ceebcae9 |
|
BLAKE2b-256 | 2cbeef4f1e8976ed4c0d349bc552cd8e83b94c062a47d2a3fdf31e381f994188 |
File details
Details for the file pyAgrum_nightly-1.16.0.dev202410101727562243-cp312-cp312-manylinux2014_aarch64.whl
.
File metadata
- Download URL: pyAgrum_nightly-1.16.0.dev202410101727562243-cp312-cp312-manylinux2014_aarch64.whl
- Upload date:
- Size: 5.5 MB
- Tags: CPython 3.12
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/39.0.1 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.15rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a11e8ff73f67711bd27569a42e13791db904880f34a7000dde280dd67236b05 |
|
MD5 | 5698ba55a6d13b78b401c51aea0c7d71 |
|
BLAKE2b-256 | 5c4d7c1b33f4b101a7e36fcaec0a09f64d2707a55d2667b608a89f94eb6888a3 |
File details
Details for the file pyAgrum_nightly-1.16.0.dev202410101727562243-cp312-cp312-macosx_11_0_arm64.whl
.
File metadata
- Download URL: pyAgrum_nightly-1.16.0.dev202410101727562243-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/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/39.0.1 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.15rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4eee06906ec7f36b421af2c2dc36270aafa6942a5a44b12a8b5ec587fb63942a |
|
MD5 | bc37ba888a91f7ccbd7e35834aa26f46 |
|
BLAKE2b-256 | a7c7e46ab2ab39b1bf2ef51727e50d7623fd218a850a344e5828fa5de5e9a0ec |
File details
Details for the file pyAgrum_nightly-1.16.0.dev202410101727562243-cp312-cp312-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: pyAgrum_nightly-1.16.0.dev202410101727562243-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/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/39.0.1 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.15rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba713c217a0206d8654f06e3bca0dce9b9dd52c4751e6f33b28877e47c29a5d4 |
|
MD5 | b1351a8cc82af1ca31e29e9b17309bde |
|
BLAKE2b-256 | 35457fd19746352e94ef3eab2d756015a68b612b3ef4fe6648cd9ce461daf34e |
File details
Details for the file pyAgrum_nightly-1.16.0.dev202410101727562243-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: pyAgrum_nightly-1.16.0.dev202410101727562243-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/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/39.0.1 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.15rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8cf774e58433ab109e24ce9b1c27b6c0ff12d016180aca811e4807a4a027d886 |
|
MD5 | 4e7e2faec002427840681e74f73a3494 |
|
BLAKE2b-256 | 127a0e29844da5c4b1bce14e25d069c1c34bd97217ca205632bb429b57f41d59 |
File details
Details for the file pyAgrum_nightly-1.16.0.dev202410101727562243-cp311-cp311-manylinux2014_x86_64.whl
.
File metadata
- Download URL: pyAgrum_nightly-1.16.0.dev202410101727562243-cp311-cp311-manylinux2014_x86_64.whl
- Upload date:
- Size: 6.0 MB
- Tags: CPython 3.11
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/39.0.1 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.15rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d41152d06555edc90dde7333dd73884e331ab1b38673ef52bd52461e7d66676d |
|
MD5 | b6285d8330282072f74228cfc5cb1e7c |
|
BLAKE2b-256 | 9b9baaadd9ba4a1d23bdc08951ba8f26c585165d0316381cb6b9f4bdc9b46164 |
File details
Details for the file pyAgrum_nightly-1.16.0.dev202410101727562243-cp311-cp311-manylinux2014_aarch64.whl
.
File metadata
- Download URL: pyAgrum_nightly-1.16.0.dev202410101727562243-cp311-cp311-manylinux2014_aarch64.whl
- Upload date:
- Size: 5.5 MB
- Tags: CPython 3.11
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/39.0.1 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.15rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 675d052cc2c52f16ce7d3cda6ba33f27abaef34ec86dd7b55690fc633f4dd111 |
|
MD5 | e9b1fdf0976228923b10666939026f67 |
|
BLAKE2b-256 | 8322b1b1ada60fe7454f3fe84ee5c5ced337a2ee70391bf249cc221096312f7c |
File details
Details for the file pyAgrum_nightly-1.16.0.dev202410101727562243-cp311-cp311-macosx_11_0_arm64.whl
.
File metadata
- Download URL: pyAgrum_nightly-1.16.0.dev202410101727562243-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/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/39.0.1 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.15rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15b9960687a7dd746981d40c9fdd9bf81ac095b22c8364568bdb1eebb7df0171 |
|
MD5 | 1324958d07be697adea901d8db7600b2 |
|
BLAKE2b-256 | ef848c3d3a1414346b2a208717a6f9afda5f540c8acaf9d1656ee6a5b35e2f0b |
File details
Details for the file pyAgrum_nightly-1.16.0.dev202410101727562243-cp311-cp311-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: pyAgrum_nightly-1.16.0.dev202410101727562243-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/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/39.0.1 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.15rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34bc02474c42fa2cb8a9d2392dda254048c686c3fc8c23a88e6619a9a1dc77fb |
|
MD5 | feb6a6bda4d0aa054b5c7add3879ca7a |
|
BLAKE2b-256 | 3855e8772d09a0f3c5a50eb46c1dc5c3b82fb090d1656425deeed110f3303742 |
File details
Details for the file pyAgrum_nightly-1.16.0.dev202410101727562243-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: pyAgrum_nightly-1.16.0.dev202410101727562243-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/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/39.0.1 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.15rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0cae1e81c3d830c639b8a10cc485dd7e5e302c2d09270af6de2c28812330a5d |
|
MD5 | 12e5048573b602ff70d44de43423aa95 |
|
BLAKE2b-256 | 4b7ba197418480a6bcf3aed08b6e5a1b93ff7c3514ff8add82721cc31c8e3c5c |
File details
Details for the file pyAgrum_nightly-1.16.0.dev202410101727562243-cp310-cp310-manylinux2014_x86_64.whl
.
File metadata
- Download URL: pyAgrum_nightly-1.16.0.dev202410101727562243-cp310-cp310-manylinux2014_x86_64.whl
- Upload date:
- Size: 6.0 MB
- Tags: CPython 3.10
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/39.0.1 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.15rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c85acd8197a2477d81dc65fd9df83e4a3873bf74d9c37cad5a455c298d75513c |
|
MD5 | 7dec2a5012d68730ab49a2718880748c |
|
BLAKE2b-256 | 10ebe5232710d4f3bdd3e3acffacc812ada34a35036d8db548a40b969c225399 |
File details
Details for the file pyAgrum_nightly-1.16.0.dev202410101727562243-cp310-cp310-manylinux2014_aarch64.whl
.
File metadata
- Download URL: pyAgrum_nightly-1.16.0.dev202410101727562243-cp310-cp310-manylinux2014_aarch64.whl
- Upload date:
- Size: 5.5 MB
- Tags: CPython 3.10
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/39.0.1 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.15rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19216aed4e9784354a8af927a44806aa2fcbf39c080337e85da6b1e83a434346 |
|
MD5 | 61381d52b03cda02a76815a60d44cb83 |
|
BLAKE2b-256 | 298cc8426804c9fb11b7bda037245701daf1f40b6febbd968ab989e4096e5ac7 |
File details
Details for the file pyAgrum_nightly-1.16.0.dev202410101727562243-cp310-cp310-macosx_11_0_arm64.whl
.
File metadata
- Download URL: pyAgrum_nightly-1.16.0.dev202410101727562243-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/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/39.0.1 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.15rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bbd6966da6cea1d8557d380f71df687b3b0b476eeb63d99f055e68c20879789 |
|
MD5 | 90c23dc88a91ee75cb0b82bd18dc2bf8 |
|
BLAKE2b-256 | e9a5b535071f21ed5906cf32639bf1d61c5f0e484e419a6090395c451b33679d |
File details
Details for the file pyAgrum_nightly-1.16.0.dev202410101727562243-cp310-cp310-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: pyAgrum_nightly-1.16.0.dev202410101727562243-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/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/39.0.1 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.15rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c75655ee8acafc9e3c50af62168459be2781536e49e9b4f60020a57617bf6a41 |
|
MD5 | e024c80b22c527df3415c6c3d0c5a089 |
|
BLAKE2b-256 | 05bc32847d89502c4d2d5a059ea6eb7f50fc5cdd180cd3463041ba236308629b |