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.dev202502201739452835-cp313-cp313-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502201739452835-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.dev202502201739452835-cp313-cp313-macosx_10_13_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

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

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502201739452835-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.dev202502201739452835-cp312-cp312-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

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

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502201739452835-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.dev202502201739452835-cp311-cp311-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

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

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502201739452835-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.dev202502201739452835-cp310-cp310-macosx_10_13_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.10macOS 10.13+ x86-64

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502201739452835-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 79711f00e9480d01f0878aa9cc30cdff3bccbde378081c66554a36fd9d5085a4
MD5 a96c4097e01b01c46d9529b736f9119b
BLAKE2b-256 d2e9a0793adcd6164c1ecdb3db396717070f0872d3d5ec833df79db65554806e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502201739452835-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e689f6fb9dfcf7d731933ea13f662152408d91958831c5a0a003e7db9984d8c9
MD5 0e70f01aac5bf12c4d1265079efb61a4
BLAKE2b-256 1f46e278d9f18d6d1dcbfdb62005d90513f465f5caff101dc653783e3b898463

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502201739452835-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1cf760a39fb6638b521a32631ca5d3cad8660a3fe97947a36bfa88a91d021f98
MD5 903d7a0ed2c3e6a7ebdc69a3b2456e25
BLAKE2b-256 0451223c5d0004e7d68f98d2a4fd1911fb2ea4d1ee9dc448815cc5a3a58b8132

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502201739452835-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cb41e3eaacd05746339be4b16d63dae7f2f23bfcd18a40bf9d86f4caf0c437d3
MD5 12241ef54ffcccd4b2f1359a7b7ef4e9
BLAKE2b-256 741cbaeb5bd7968e3798b491f3391b37396845413b567d461938caede5e5f37d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502201739452835-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 ab6de05d281ec509b59019c6599ce5a01688d7554e8ebdd36dcb97e0eb86033c
MD5 eb892d39548cb462a6c0a69fae81b6e0
BLAKE2b-256 4d18e89169eb3e6d6a2f4ee471d424ce9a96bb1af31f796361b4b9e9ecf78bee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502201739452835-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 529cc446c9ac1768af9dea0e85d0450c4e358dc531942aa3d32fea2de5afc787
MD5 4496924c32423dbd2938413333592f34
BLAKE2b-256 d3979ff0103873c327b8d25ea42aafbc1388aa11fd01b4ff3bcac74c7b734986

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502201739452835-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 49ac02697133debe5010691fa3de52d77fd08c219e42d90d5d9b1c6bd799a738
MD5 fc74b0a2954de22df0704deb1ab9f3f8
BLAKE2b-256 c545246e62a09a871389ecaa283008413e141917407fe80beb89e2c9b2e41e09

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502201739452835-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a044a2c9bfa19b5a56b138cd0165c3141fe24dbeb3b2be95fc5d1890912b061d
MD5 5d5eb2b1bb4609801e725b4d6bee2020
BLAKE2b-256 ed6ce13786565c2952a6e7772107dba756977ba9f7639dbae9765843a8441769

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502201739452835-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ca4fa4e387d6a99f09f52dc8eb062e7f43e9b44b5fe8aa8ed2c6ab9df92dd88b
MD5 77d0f5e10bb748a09bfb775379f40377
BLAKE2b-256 a8b4bfd83c6081d4bb53f539196544b80cca5fb62869d67c4229b1c4cd65e5cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502201739452835-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 670266dedb037ec03a4a8d110f1abfa15095551bacbbf4cfd7e9799d62f1f5cd
MD5 3fcb43208b94f39934784a3e2d869586
BLAKE2b-256 97a772c0397b0aeea21293697da5a7b823f18515fc366183883d81c72294854d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502201739452835-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 197597d26ee9e72aa9e1344c0f514cb05994b6f4f4906a0eaae8a38e19b28ec4
MD5 eba670d83d20e5a99d6de6dccb05199e
BLAKE2b-256 02f16f4cb188180b1da6b3e942237f8442d81f8dcee90cb50ca907162ec50521

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502201739452835-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 98b52b9e08ffca0a5eedc091bdcf1d75f53d44c9d6d91f820dac908ad1ddc8db
MD5 5d450c84eb564ead4fb88acccac8cde6
BLAKE2b-256 c1ddc39db4fa417cf5bb15a653f13515ce2a36b6295d8f1cc653e66dbdd31500

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502201739452835-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 19a2fa42d8f88f02fbd4f9d2bf8597cc2638067b45103434f2bb0bdc7545b8b2
MD5 6239b97c018dd82c28aaa6320563aa1a
BLAKE2b-256 9becd9bf080e30ae877f7f66896be75e7309edbdfabd59780720841d1285d44b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502201739452835-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 758251c856a8956cc9a6646e783d5702b6f9bea5cc91495750fd7fc387757bbe
MD5 bb833e95f67d3ce49edc5a505e9eea00
BLAKE2b-256 e49ab5df55494888ac23769fd635fbf03dc506e51c2fc69f7ced7eeecd46e03b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502201739452835-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d27e852e7b70e0b0bd54eec3c794d9d05f5e9b0a748de19d9679f1f29432a419
MD5 4fe306c36009124c1850f1eec47a923c
BLAKE2b-256 560d3447459a43a4fa56cfed534e8d953b06c722f6cd3366454a2de0d34c1b26

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502201739452835-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 cba4b4a71335b3fbf71c9da85150ecc3a978c4a8cde6600177d1fd12d86e5801
MD5 0d2a0662502d9bc59492b8262522fa12
BLAKE2b-256 e11efa3e1c0605eb11d4a37195fd9461f5e235240d6657d9ef15f1213a986ae6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502201739452835-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a64c8ddbd7dae13e793c867e8352ffd8e313f2e3e131d1088ac89194fd4e520d
MD5 4b092061a59d8a0384e5aa02c6c99806
BLAKE2b-256 afc6ddbfb7cd6ba34fc479ce6f33c4cb5c5adffaba049ef155d8e8c1f693db2a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502201739452835-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 861c36bdf86fb2c72e509c2b3c8734deb2a6cc6d8ff833e99504599f18f56f35
MD5 236aa5df9f5f1afabd52f4efc5661eff
BLAKE2b-256 4a99f1ce5c79437372a062a63266558424018583c840ecef41b940e7beaba3b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502201739452835-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 93cf3b835aa4a7127f0e810b7ac3d4c044e7a1b085ed8231f050977f9e4fc03b
MD5 9442bdcc804e00590c04d50aa2d4f237
BLAKE2b-256 e98f3ab292d8c20ec80e38bd85cc9181c3a278f6301d0eef4d2087ca91db29da

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502201739452835-cp310-cp310-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 82a7ec57ce31a017abcc9e239cefa329b0c08a7db9f4a4cc74e8e655a51a67bb
MD5 0742161738b6afd0006cd3f5e05d8d93
BLAKE2b-256 0eef1bafea9164ed5504b51a774f467e12ed61e66e3f647a0563dae6c5856f02

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