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.13.2.9.dev202405171715182293-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp312-cp312-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp311-cp311-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp310-cp310-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp39-cp39-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp38-cp38-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp38-cp38-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp38-cp38-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 169e7ecd5644378a4e76a6e4ecab3624de305f3159e4198db6105201f5205444
MD5 6f775e9689690ec38131a22c12e0596c
BLAKE2b-256 397944d838f2f7010816b60c9fb88afd675b462bfbbf7be17a24878e749e31f4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3fbfbe299129cb21582d9bd60c3b7468e5d3521ab50f3eb22692348e64fd2bdc
MD5 e044e2d31758c0f77df40b4367052d2e
BLAKE2b-256 1c981f6a7191f7120dd7edd48336e6769c30108195a624750ceb60cfa9a7071b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ec03a183cdbfe9fae06fff8b62296133c97f191c306a1a21f624c3c63db6b7c2
MD5 ff41b7515cb823f4b36282a44a97c2e8
BLAKE2b-256 ec047b6de1a65f6cf08cc5f840dcf74beeea8c2d3580639565d578410b04adf5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8afb353c05492ff0fc3178cfb4e7e80d94b1279c47fda3398e1daf0c2e4dd068
MD5 87d94dd457666d2f5df7aad13f019fce
BLAKE2b-256 a9da98da340704b046bd279375700763ef08dbeabb5ccb4d1dafb54098e39dd3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e6e1dc1277f871987d761c4e31b984c873cbe9239ecb3cc3d8b2b86179636053
MD5 a11e05d47e563d1bfd097709023ffe64
BLAKE2b-256 964affa72994467e950c69ef4c314d8a648a5bc988ee016d02d7f0648e231333

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 662b5ea35ee222ed755f27f0afefebb4f53731a39357c47758d0a1c05edb9dcb
MD5 b8032138d5ac38ca2ad39f7ffa659bdd
BLAKE2b-256 fedf74e7f54cf64f94485b99841d78f23418fd334ee8abdd3fe54699d12bf053

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 94929cbfb9de030a2c866f0a754731373771de61a2223f1eb61d1e113ddb5099
MD5 56a3ad04c4054b94b795b143ca0d3f05
BLAKE2b-256 5475f346c1ec1c72d1dfd0fc72fd1b9263485b89932306953eec753a2a2bde91

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ff972a5ea5efe4fb3870683312b0ac504b105b09f4706a28dc4a5351937d0d2e
MD5 0e60a602ca459ad2167b50f5de673f3d
BLAKE2b-256 caf2ca40edd2ac98b689695df730df5c2a7c13c43ddaac7081feb2e97c02f21a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0c842c6be1b78bda00ff845a64bd726cf4c755ef403c7d1cef7be07aafa82d44
MD5 07e8e90f09532e194ac5b32115e6ca20
BLAKE2b-256 4e453f1608ec8c052d79a4c13d35752ab6afa0884873783bc201dde24c2ad349

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 da6d52235a00bb47cfedaf80ec5a0dbc95fd23feaa7f7fde3a9578e14ce50e02
MD5 21c3c80c24891a6d81ab19631cda5ee4
BLAKE2b-256 7f3dc610e747de3c5db8e7554b576ec3d36f5e5d34d8eefa6dc389d1c9e9b219

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 14dd2072cf0c7aa4bba3628f2a2084e8c18e1c8f7a25df82c19ad42366ef7b67
MD5 e7343bfe6ce8fbad923efdaaa6503fe0
BLAKE2b-256 085e3c398868bd7897abdfc410941a79d623b40b6a89e78055b86a8951fede4b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fee14f1c4985366ca3a755777ed342a2f5df387fe74ff2b31f34cb99f607aa30
MD5 4ec42e54581e9c34c2aef7b30e7fb62d
BLAKE2b-256 eb7ede23c679511d28d94d142b1ef0725711328d63df969d721b8be50b310260

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 716cc916e27c2273cff3a6e6a98040ca0f9896e40e63ef9af3c64872177c4e54
MD5 ce6ee8ce68cadc8238203137fc999b1a
BLAKE2b-256 a0c8f9218ca2c6347adb9ab4b0f4719f77b40584d35b9ef25ec59925cd136d0d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6423879079f67806a0cd8a0f9d82bf859ef5968ae07f662ca3cb24e3d25bf685
MD5 b06bf9adc85ffab9b90725d7683b6e5d
BLAKE2b-256 c84ad9e145823ff414203d387c06c4f6828513eb120b140eb994f1154e124f52

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 355d7d09575be53a3129f9afd7cb7b113233acccbfd0326bbad977db435e490f
MD5 7ae1817a395744fcbfe4230254a97034
BLAKE2b-256 0e2bdeddc99fc765c3b62a0ade9b212c743654d60c2c4d1ac2fa898ebc355de4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 922c4d3bd901e9ffa6ac4cd614aad7fa7bf6d64bcca2edde257afefe792487e9
MD5 7cd4c9a90c5872efbf1ca9cd30e1b740
BLAKE2b-256 1238b1be49c514624e233774a6e3a430b40dbb1cbce3480698b578a5031607e2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ca425ac2e613397ef78422efee5c4cc79cb2699b7618e662cc2860f6deb10dc0
MD5 7d842237a1813debd9ebd8c4e4a79c86
BLAKE2b-256 9870328bb574f86a96586054eb2b04440a5c26a7e96d0566f331e893754d5b36

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 cc5198a776c3397b0a702c67415cea088bee21ae8559037eb9280158a5b6c43a
MD5 35bb48028b574846b029865207cb8143
BLAKE2b-256 51dc4df0c2e13ef2cd7a00cc750caa6ea5f395200a9bc8166030eb139804bb3d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4d47d022b3b5dd4dbc2e925cef819cea7069a320f154e59586b4b320d9b06550
MD5 65c08b74d2d2c04ea12bc71c5f4ffc23
BLAKE2b-256 fe9cb3fb2cc67e24a3616705730a9337b94f893ae5ca73961d30475ca045bb3c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1379725ce2eb0a662368cdb7c81ec6b6113c8e32207bde4c270b9d2a1cd3bc95
MD5 44eef0d76d158193b1a02ace0e2242b9
BLAKE2b-256 fc3e61a5f48646f8f56127c1b4092fecb9f22c8d552cf532fe773e376e0c9f41

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 98bf1cec6948e3185818fea2513f2712e63f9bd69bd701d3a419eb1f16c826ea
MD5 6a614d393f79bc6bb3d7f7b4f24a4f07
BLAKE2b-256 958cb112ded851487552cb6f3099fdc5ddf34d128f722e3a4e674c280c45e1d0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 94c0e719e6cd0bcbf84aa5528d263d70b47284cd959555daaa0756fe072d4f1f
MD5 5caedaf6f36636058582e7d5fbb7474c
BLAKE2b-256 6beeea8005fdce36bf59b1f60fcd93c586ffa20b2ee40a3ebc26544c8579b995

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp38-cp38-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1795b663150dc844096f8f0402b2886948f020ff9bdc0bca08537d60123a19c7
MD5 83a2282bfc842b74ad364d9bd538d3a5
BLAKE2b-256 fea68787d800598277f5e05add87f8b28e7e79d1cdfb9bc051103c05eeb9bf0c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e0695444070ded6d7fffcda8b2ea35ea04635979a3ebeb89f3f2c1cc9e5d49c2
MD5 a0e92e35533160cbd7ea33724ba966de
BLAKE2b-256 1c8dfa628d1e1deff2a9ead4ba8f975c3aed626f954b30689f119f58a4f01b97

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405171715182293-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 394fae9a02448100591d32fadfed08df4849178cd34df0e14c9065490a3b8398
MD5 0d739c75696727cf7c06e63c20ac771e
BLAKE2b-256 a847d08b6f91432db5bff28126e7d9f9ed4cf9651fa424bc7fecf91a4502ccd7

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