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

pyAgrum_nightly-1.17.1.dev202411111730930665-cp313-cp313-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.13 Windows x86-64

pyAgrum_nightly-1.17.1.dev202411111730930665-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411111730930665-cp313-cp313-macosx_10_13_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13 macOS 10.13+ x86-64

pyAgrum_nightly-1.17.1.dev202411111730930665-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.17.1.dev202411111730930665-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411111730930665-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pyAgrum_nightly-1.17.1.dev202411111730930665-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.17.1.dev202411111730930665-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411111730930665-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pyAgrum_nightly-1.17.1.dev202411111730930665-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.17.1.dev202411111730930665-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411111730930665-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411111730930665-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411111730930665-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 4b3fd5c010e95fa707798b9dfe63dd7e62ceb3b3e43590849bf44c25b6e0b161
MD5 e1864f320d0dd81c76ec2f6dad5974f0
BLAKE2b-256 acd7ec6ba932d9c34aa70565ca7910f628f6f3e167701b7738bff74113bbff3c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411111730930665-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411111730930665-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4e676ce53f5f41e8802942785eca731353202e98f7275ad80f9ee853e835b4ce
MD5 23857f0ecf51ce103071d7c16cbcf265
BLAKE2b-256 5d847a2e89c2af7a54ae81ae0476cee5cfd995e8351f9f701e8a20a789659235

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411111730930665-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411111730930665-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b3f500671ceb3703c25987e68bc68ea41a692541d7f0dde4fb97029567937b1b
MD5 4669eacb35ca886a0924774751547837
BLAKE2b-256 17f105d52150081d9f999f7836d7611081af678f9fc9c82371e3d307fa9a4e6c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411111730930665-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411111730930665-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 67dbc4c74a2a976a946e49f2ef49d75a21fe679d58c7401afedf575e5304156e
MD5 33da039f8bfec3690c44eb8b862753b8
BLAKE2b-256 dd2ca184a39ad5ed9fe9d9318041c2413d5a555eab2111c74845612cbba8717f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411111730930665-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411111730930665-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 e883a820c8105a1dbae6679ccedfc9c6874cfc6cd6772a2909541e8d83b924b7
MD5 68d7f131ca77e689555208f5185f824e
BLAKE2b-256 9e51eb4a81ab79a8574bbcad63f85794eed5f5636e56a5e4aef081712cb9c809

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411111730930665-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411111730930665-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e3449c76f3c1c9a8fb5a98e0e6c397aa7f33d731a5c015c40316f3d5a8c9affb
MD5 b5168c45a3bab6e2aed562a7cea34822
BLAKE2b-256 a59e58dfd7c66dffc9f326573373ab3dd5270cba0d417e813feb2897051d71e0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411111730930665-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411111730930665-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 61e96a03a851164822864ba0a4c529d09a3ac47b9fee01addc6e249513e7f256
MD5 8f918420fa76044b1e2ccc1f51452297
BLAKE2b-256 fce7af685ee4efaa0a234e63e1bf6ed9c5c24ad7dba8b92880da41c639d7f9e8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411111730930665-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411111730930665-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5369a321d0fef7316f1c962c6faada51a016ab9f5a48f85f6ca118a06677f7b9
MD5 20efb145144731f662baf21d3651470c
BLAKE2b-256 62fa7871c816feef5ef842a826408b978aadf6874e90f624511a4e26237e7717

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411111730930665-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411111730930665-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4372126113de8005f3919857551e72f28c853f3d4be3e4ed0dccaaddc4431ec6
MD5 9ee6416e3ed7237702f0d86081bd703a
BLAKE2b-256 cd208d6d27551d4b1def64c66eb03e16da4375f8c740351011210b813e011f73

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411111730930665-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411111730930665-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d8a2d3a667c0696f43e9c4194aeea0e5a9ea7d71e62bc873bd23160e2aeb849a
MD5 5469d7d005433ff45929c7d837091642
BLAKE2b-256 8634b291766929255dc9af9b9392c0be030c4d457eea0a5cedadbc872bc057ac

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411111730930665-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411111730930665-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d22daf50a5b98db1b948e340db3dc413df4fc6ad3d7533bf54ef2f4ddf00d07d
MD5 854457db7d4f952abb58dde994b98694
BLAKE2b-256 101ecba0c5e486df215e8a49de19f0140cfa58d9b9a919ef7673e7f98954d3f8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411111730930665-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411111730930665-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 aa0bc02b2e971be7404cbd46a1837df55e12cffb4a88a3468445bc444dd58908
MD5 cebfdc7bfdb3b8bf8aae280c7d890e95
BLAKE2b-256 654e8fde2b102f7162b82645378e00d886ec6c317b4fafa369c557ee00ba0d20

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411111730930665-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411111730930665-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0dfcb2f7bddc719569661833ff70265c5039e4a39a89ad6c7605c665f97e337b
MD5 913dded9ee7145494f9eb7672859583c
BLAKE2b-256 f75c9ef70bd18a89f4d04a207a3b9d8d95666a78b490a5f08094da98131d7089

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411111730930665-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411111730930665-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6dc9c86db9a25ee4c344ffce95b90be1140ec5a5e7883d0a43b7d28a934f88e1
MD5 cbb0cbbd39d51d67a6a601f7015a6d6b
BLAKE2b-256 a79d8abf52fe384167ef10454f9453c30710b5c47afdf0d431f93ad23f5eef02

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411111730930665-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411111730930665-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8d3610eeee072052139ede5e924713ad7712fe76cba2ba19e697cfbc30fa5a8d
MD5 f39bb12246a6b7bcbbeae8af9367461f
BLAKE2b-256 747be4994901184d8a257e9bec73ad235f0dd15b576f313dac483a79b6cfdf92

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411111730930665-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411111730930665-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 9fe48e1921abce339dbbc0938c15b40eceace80cfb4f27ea48ca88fcf393a22a
MD5 f0a8227520148fda7b85c6a712e35851
BLAKE2b-256 dea72f89a300c117fe11bf3ee546cb0b8f639ed249f357154a09f2279574efb4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411111730930665-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411111730930665-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b9336e5989c24fdede6995c340c6aaa9b142c9028abf1010cfedd21524dedf80
MD5 f23853233d3d6b468661419ee167cd18
BLAKE2b-256 f46ffe5a0f1893267fd678e11d27cc5a06dc8df44fa0e22e50362880fe7b7e79

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411111730930665-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411111730930665-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4a50fc8c5f7b1aead8ca371a47d60383062a33465c92aca407df13520b6e2d3b
MD5 fd2ef346d2c2475fe89d1949fd75b567
BLAKE2b-256 c0888754829d5275ba2514ac8535e1cae12831a6af8a87d0791d49df0a4caf5e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411111730930665-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411111730930665-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b8ab28b09a155a9576e9d2d8f1e1d907fa751bd4b4716e030f029a8597043e5e
MD5 41e510a79980ccb1023e52c325e60f5e
BLAKE2b-256 b8fc65c130e8e949b2d2073c3e7ec6cac774fb1b091a87eb6b432a02c5a9ac0d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411111730930665-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411111730930665-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 dc20a64557e15b470aeb4601fce284b697f2af2cbac5dbaf1b6deb0e65dd0e95
MD5 27b626b998d70e7cbc7dfab2f05ecfea
BLAKE2b-256 c1eed0477074b4f1e33bc585d841bc16d5c7bd910b85cd752d73548515e0f3b7

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