This release is a pre-release and may not be stable for production use.
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
Metadata
Release files for pyAgrum-nightly 1.14.0.9.dev202406221718113029
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 32.0 MB
Release files / pyAgrum_nightly-1.14.0.9.dev202406221718113029-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | pyAgrum_nightly-1.14.0.9.dev202406221718113029-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 4.2 MB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
8dd4e7f18d337559e7c6d062cc634ff7e275a9e11760225cbc46288c81271cdf
|
|
BLAKE2b-256 checksum How to use checksums |
b9edcdf4526436f1310995ea7603d84d30a0715f6286f289b9358557e8f52615
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / pyAgrum_nightly-1.14.0.9.dev202406221718113029-cp311-cp311-macosx_10_9_x86_64.whl
| Download URL | pyAgrum_nightly-1.14.0.9.dev202406221718113029-cp311-cp311-macosx_10_9_x86_64.whl |
|---|---|
| Size | 4.8 MB |
| Tags | CPython 3.11 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
dc6435dbef6fdd300d89364c0def7b7b2b5e13f7b15109ce93492b71f0f5cb04
|
|
BLAKE2b-256 checksum How to use checksums |
11125879c7c9458791f3004124b2e2266e0f27b3e0e57b09d808d2cf5a8f0767
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / pyAgrum_nightly-1.14.0.9.dev202406221718113029-cp310-cp310-win_amd64.whl
| Download URL | pyAgrum_nightly-1.14.0.9.dev202406221718113029-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
2a0d52b51cca3db3a6be08730d1e8c883216ea141ef407f81733781da7cb7109
|
|
BLAKE2b-256 checksum How to use checksums |
55934b5ea0c89f923fe9686a14c68c3cbcb6eb38ceaad50026bbc6a8db4125ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / pyAgrum_nightly-1.14.0.9.dev202406221718113029-cp310-cp310-manylinux2014_x86_64.whl
| Download URL | pyAgrum_nightly-1.14.0.9.dev202406221718113029-cp310-cp310-manylinux2014_x86_64.whl |
|---|---|
| Size | 5.9 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
57821942bfeb5ba4d3bc13104327f8cc60b361f805823c567b034a899079dbdf
|
|
BLAKE2b-256 checksum How to use checksums |
c92ec0908ef3f409d5c8ebcc44444c5cd49a85597ebd2becfc815e71f6d02a04
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / pyAgrum_nightly-1.14.0.9.dev202406221718113029-cp310-cp310-manylinux2014_aarch64.whl
| Download URL | pyAgrum_nightly-1.14.0.9.dev202406221718113029-cp310-cp310-manylinux2014_aarch64.whl |
|---|---|
| Size | 5.5 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
40a2188edea8ea89e6d8bc31c50e376d3933eeac1b62dc84c332d0f2118961d9
|
|
BLAKE2b-256 checksum How to use checksums |
93e0562c8334a4f1c5fd31fc7ec4c2729d689df82c0578a9983c1c5fe36362ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / pyAgrum_nightly-1.14.0.9.dev202406221718113029-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | pyAgrum_nightly-1.14.0.9.dev202406221718113029-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 4.2 MB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
cefd44b1ad9e843541a8665a6b8d96e278b4bdbc69fabf0aa568beb68f5a4987
|
|
BLAKE2b-256 checksum How to use checksums |
03b28d44f9ad8671cb2bbc41c74d7c03e176671281178fe314a650daa45ab4ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / pyAgrum_nightly-1.14.0.9.dev202406221718113029-cp310-cp310-macosx_10_9_x86_64.whl
| Download URL | pyAgrum_nightly-1.14.0.9.dev202406221718113029-cp310-cp310-macosx_10_9_x86_64.whl |
|---|---|
| Size | 4.8 MB |
| Tags | CPython 3.10 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
2d3b2953f1b1858fe929e4c9a9c16b84cbe5cc7a9c8f15aaf1eca5ff62dddf3b
|
|
BLAKE2b-256 checksum How to use checksums |
5dfde351eae4f870fafcb34e0ab6a393eeb11f8d94253a5575f5fe29f82bd77f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|