Skip to main content

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.

Authors

  • Pierre-Henri Wuillemin

  • Christophe Gonzales

Maintainers

  • Lionel Torti

  • Gaspard Ducamp

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

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp313-cp313-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp313-cp313-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp313-cp313-macosx_10_13_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp312-cp312-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp312-cp312-macosx_10_9_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp311-cp311-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp311-cp311-macosx_10_9_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp310-cp310-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp310-cp310-macosx_10_13_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.10macOS 10.13+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 7bad398dac048de1a041645f2803866b25e362ced6d0a67fbe7f89ec93a7e67b
MD5 5bd0e2b88aaa9c070e5edd01b0c775b7
BLAKE2b-256 b4c8029bad45cbc7e0828c3b93b19cf402e42079e679cf1efc43b63d40a654c3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d695d3da22900879c5e63673eb79315c0087e44121b6af660419ab8b00542f0e
MD5 7225bb9a32c6f81f4eaaa533a0e4f2de
BLAKE2b-256 11a9937c3d9c7a011c9606d418d56f9874e16b25fc9df80e7fc9807486f2bc36

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4ee1942c2dcb6c985ae37f6f4e1fbc32c6963dc6a4813453bdb8f338d1a37475
MD5 123ecf0f91618406533e5ba8c2bb6a89
BLAKE2b-256 1068e5e421b3c90640dbf9b726fed3a71fdf3f6d6d974c7d87957b58a4526812

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 625d21db9233ed32d02cddc375bf1b10c78587c521de56bb60a9209cb3af236b
MD5 67886ef8915e5312f0657489d1830ccf
BLAKE2b-256 44c8d2c3eedb0a8f47ae891bdd5c30be09d1337eaafa68dd4da01f61849d9ccf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 fe6acfdf4d29b94abdd5ace9fc60e9922ddfb8a422f84d79eda31cb63f07506f
MD5 e3a0bb08e32423cc8b28b8728f20afd5
BLAKE2b-256 14bb5b69d6369aa856970eb09a0a97818c2f7b57f4a03a4068f246230342d88c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 7324003d6c551e9e2a4904733d74853eaa7cc16702931a3debd303af1814b58d
MD5 9fa3ecdfb25465e5787abce89ee768cb
BLAKE2b-256 322785093cf25c37e266aba586db80f89c11f393335e3944b18b1269b69e25b4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6c5d35849ae932cdd440b9481612e234c4d8772922da1c24721e87f36a487d66
MD5 0a71b92f5e25f130a91882291950ef21
BLAKE2b-256 c118979a5e4f251c9a3fd34f1447cffa5a66164752d17d5d5523713fc57b1891

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f6c5bd857221f3df9ffa2d63ef5adef584311c697fb5e06a2dd1e14561ebfbdf
MD5 529baf870ae07e5f06509fc01ce62407
BLAKE2b-256 385ce7e0bda16168e1029b10e344f13917581ac8bc38e41a344f7c0829eefa61

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4901494cf56d60b61e8743767a38a252c70744a41530566946334b760b317547
MD5 9f3b90d4dd05f93ee216b33e65a8b17a
BLAKE2b-256 e242d92989fefbf14753c9e68b4b9ac2ba4cc74a54d76968a6f48938dc885a7c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 974d9b53fcd73a46c18c4c66fb7bde6657b394405709ca66eb0706c843c21db6
MD5 33481c04a148d70b895639b3ef71ef3d
BLAKE2b-256 49acb90d52e977c3ae0fb3a1774c05d4f5b340a39f6835dfb412ce7f32b68bff

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 9448911ce011ad7880e118f3f675ea8b724da9063898c128da3e6896c52fbdc9
MD5 02cb1fa8f452246830a9718f5523e7d2
BLAKE2b-256 4438173ed12b61a15947840fe5f245290ce30f1c14820a841c9803a6d261e112

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 675c12556bc97b98c41eb240ed94f534ba00e20655bbc136fcb57d7745aa8dc3
MD5 8eac110147314cb65ee2e383894318e2
BLAKE2b-256 22cb603448b8aad7eaf5ef2e53d364ab2bdb0d547ed32e446aa58ba2dae93cd1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b09e6225fd298b4afe59f2b6535c428824c87fa80492de8f8616eaa553527eab
MD5 42d9a7edab9651368dc6b48959dcce29
BLAKE2b-256 26c31f1f8fc9bf1ca8f4b9c450d160261e1b3b5fb074a98c3069daaa337042bb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7655bb39dea1a6ac3985cc1ade3a24ee806fdb09698149af742d046fc7483ea6
MD5 a6834cf71603911dbcbb02a9b4c02869
BLAKE2b-256 440c0b498a1dce17cbb59377395e4f3f8681dd32e70351d96f88360b6cf87262

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8acbcbd7445dd933fddcae3e98ee502a3b4f1a727ef7de6e28caa1d9a4224770
MD5 1fbead12316b56a7fe5c401833c76c51
BLAKE2b-256 9368ba086fb87b6a1ef732cde99bd74a1b7e83863e76d5a66cbd83533deb9dff

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 dcb6e7cc8944e925f0977588cfb0546101480301294829acf52ed3f8015cfd76
MD5 51046f590050ed869269a81ca9783b4b
BLAKE2b-256 1608259cbb01baddf5acc937cc6fd26476c2d45c91bda2a9452cf2a72f445f45

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b961afd27992fdcbb6052b319a9adc2356c3267c5140ff02d11c28943945c4e8
MD5 bbb6265690d36363172b958f4d02c00e
BLAKE2b-256 a88aaa7c7eb06a37c26441f48bd5da9975dbbd45f77c4541493392fd0b25b4d1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ce0cc256f5ebcd9a4d750989e248e41f82158b37ecf6fa4d57dbeb3440e8b7c9
MD5 1d8ee5afd24d80dded6c472835a6d34d
BLAKE2b-256 bb5753208affc61bfc30cf3dcee9ae3fc567a1045e9ffc41aa91311c627b61db

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1d151febf073e89ba6f12fcdf4c5b7b0f7dc07374155c7861860094bd414b1ba
MD5 7f729bbaba9754cf762b8ae3e7106aec
BLAKE2b-256 c628e21231cc3b69dd0dcc77e1eac93728daaabdcd7632dfdf2d40ce8ef18c86

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp310-cp310-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503181739452835-cp310-cp310-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 c5afa37481071c7ae073238f0b8831ed33ae597a8455cced42ca175bfe9ec187
MD5 7c9cb4a65dd906f98f2aede26e152250
BLAKE2b-256 2d3b639e8cbf84d70d6352efcdd9ee1648b3c54c33649fc52454dffd60e647ce

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page