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,2023 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

pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp312-cp312-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp311-cp311-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp310-cp310-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp39-cp39-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp39-cp39-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp38-cp38-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp38-cp38-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 661ead5c09320fd4abead18e921ef1e660417c1e89f817f13c92b15bf1d7826a
MD5 8ef8095e183b17eb0d9f5301f970695b
BLAKE2b-256 dc9b863445bb76d0e1551cb236740442181ac48644f677103487013a9b04c6bf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 054004b1835af4a1699b9817b604c3f9ec575a74dc55fc70a4b898fae36ed2fe
MD5 5aaa2dc2ca79a63ef2abf6c1eca48d90
BLAKE2b-256 b15afd87b219bec0c4d1847f5e3239cc85d7b88b6f1f5ebb886673f1f3fd92b5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6d64ae526096be3625777f679a7275bd2d36b4f901cb1dfd84b1ae8795592d86
MD5 5a56c68bd4292e1d8d802582f0fb0490
BLAKE2b-256 5c261ca8e4300d9d73f3a6368fe39da74404e36655567001c4a3f1a52ee4a523

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ab0604759a1142b800170f1c85b428e99a1d2285515529181ccb6726ea5d2207
MD5 6dc95348d09cc1c342a05418ad16dcca
BLAKE2b-256 1efc0ec8e90e061c5aa13c12e3094d6c84d79155499bc09da506254e717359e4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 312bc87f7410666239fc57bb455dd9467bbe2c1319b38a5560326c43ae862ef3
MD5 c85c42a8051f03b2db9b238012552c85
BLAKE2b-256 6a4b7f5aa1541b889e6c06e91b81eb3d1ad5f26e86b414b084628a8abb55240d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 0f66adad6aa0a218625ed49357859714975df770e0736d3c40fdad5efac970f9
MD5 f3c2015c96863767446cee494305ce51
BLAKE2b-256 6de7c10f54dc6cbd3072109e68d2d74af389b31f6c3af8638aa069ffd878cdb0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e0f0ad67090d4889fb10c0f6346835c846ec54479efaf20f2f0e20a76ffd2f5c
MD5 4dddfd3b9d51446eead22c6643f78bde
BLAKE2b-256 45583cc7f2ee36524feae9d85f2b64e62bd0c49095cc0c68277e107269cf056a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2b3707273d2c0ac7ec65ae1bc1f84d5b249e8c5628a1d0a1f447768d9ea52fea
MD5 cf24c8e3fe25a4a64512bfacdf21b5ee
BLAKE2b-256 026b98e6f63358c3cb730a9e63d663df49941e9cf3a40942a552943ca527bf30

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fda9e787040d5f1601f901c698219a41808d380a2fca8026bfddcf3d5de5099b
MD5 4170e3866c0c7bf3e3c7c9929576310d
BLAKE2b-256 e1943bd063f7e35ea05b77c3fa29bf144db48900209c892ce3af9c6aff5dba66

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a68bb78f3b878734d6e8552ecc57ac7827732130264971f11414e3d87f2534ea
MD5 30fb21e00bf4c42ef4dacea5383e7234
BLAKE2b-256 79c84108a81df39b78398001f5f321012aa2b70e5d2c1e0366a6fbe9ca5e541c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e34b0ed6e05e7284206e66e1b25cb1e50bb59c437d89fa5667ac66f1b8be9a56
MD5 8a003e5dbefdc0101b84f146e73085b1
BLAKE2b-256 56292d85183da02f2f2a8a04fdc03a8efc8fc4eb92e1d562e0a7b1f4386bee90

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dddd03cfb57eb7171e540275989cfb64eaba4f25cc043d991c83660fcb975502
MD5 70158a71c8f18a7789fc3290c5ebabfd
BLAKE2b-256 da6c7c8daef305ea864529eac78f0bcbc843ff77f8c823e5d6328e7820c6d4e2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a415802c80f63ced899a0d18a77e00dbb29fba83e0a2a10d96281258e0c2114a
MD5 a0d2a79d7b0b4ca91dd0286eb8e774dc
BLAKE2b-256 d460f7fa49db7390c0d852e9e90068b0d525ebf7de4adbf598f92520a2d9360f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3a824a230331a0be4463a96645de2f4e1486d6dac2786b89ce60c8a1d030f668
MD5 01baf78276e59a9fa0202d4e501a68ad
BLAKE2b-256 07ea71cccd2f18add5fc953d553bdf7b24c8397769f5f2fb0ba9e726f8a04b6d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 fbec2ba8232c412fac8d5e86266c51ec11b4041bcf6ecd9f57beb8bcfc82abac
MD5 c593a4e8119c111d5f54635f72dbfe6d
BLAKE2b-256 6a785483502eed8a1b973fc4107fbf3ab0be96c52408f9d51b10e1cd312990fa

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 098f387b76ea90062930bd1773497b2d85c5cc80fbb24cfc0be0bf1e64fe853a
MD5 123cd69cfa19c912c67be8c7db93bdaf
BLAKE2b-256 61b7d6102ac4f8a6f3eff7fc03f37b159809e7e08c46e29227627cce84ae56d2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 21e27b7acc61b5ef3bfd4b9ed1c9b062d00f2614df1b24531eb2eb424d045682
MD5 1b4d641a4ddc551bccd0ae43d527773a
BLAKE2b-256 0ca39ad4684b1b42b4be3f77ab4c34878fcfe893172cdb4d03b2c1af9c59f612

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 55d8d28866ab0897937ae7271cf68479d50bcce65af421e73917f5b8fb3f67a0
MD5 9a801297896b6b1fb2fd2a58670e4a1f
BLAKE2b-256 9f1d8b4dc6b0762a851128daac2a974dec95e48e3b407aefe3c5673092275b9d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8ff6711f721edb03fb2ce94aeeb8a3df2bd1a0fbb009134b02de4991cdccec7a
MD5 e52840669d8bf483307501e4183a7da5
BLAKE2b-256 e67404c261e3b1b399f5231436b0c7c413f3485268d6df0dd0e9b9a1734112de

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 98727dfb7b0f220d04694b3554b2ee77a58df213d3cdc314d240f6bd6f9e1347
MD5 b6d2009c0fe9ddeb6a8b43289c93bdde
BLAKE2b-256 90d8f48f3cb4250bbcc2efc5a4e73a20c53333b9ccd62331c1db60ec89d54cd1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 34aba94941b7a22d5f3799fd5b1e77c9ba220492646ad2c8effeb79cc6685fcf
MD5 d4edfc35c5b0714979f1e47661f2b417
BLAKE2b-256 a4f54e39fbb6b42319b681c9de48573e096425122bb7227dc084d216ea045553

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1691f60098b76e342e900f59294fc15c7b8c91fa9d3e2daa762d4e8551a9edd9
MD5 385d280c2bb42d95615200c93f1c7dd5
BLAKE2b-256 0341b0bf9c3c4f551a7d082420578a29dab639073e7d3f5240a5d73986158ad9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp38-cp38-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a7d852e8c626c0ed03eae5ee76a0cfb0b03d0602b58632147c81943898428a70
MD5 7d14166fe26b13ecd45267ae59608044
BLAKE2b-256 18974447c0d11a36a5c0d48a4d3f02230028083eba48b84706f62f3aaa5a386a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 57bf3d8c8913fdfaf4f7970ddd2301bd5070f587e50ed0df821603c8b2cef54f
MD5 b1e35b9363154b95997f4ce4b9d6f915
BLAKE2b-256 012db9365657737576141b6253c9dad7e681e68fd63f805753a8ba173b0a47b6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402031701813464-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b3098e241a20408818c54005500e18725034ba738c6c17c834fe8148b98ab120
MD5 99910daaef51dee6df3aec7492571a60
BLAKE2b-256 4514a36ad5c498b94c1c9e162598177c718121b4ef26f2ef1218bc3f8b4cea42

See more details on using hashes here.

Supported by

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