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

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202408111721169663-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.15.0.9.dev202408111721169663-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202408111721169663-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.15.0.9.dev202408111721169663-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp39-cp39-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp39-cp39-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 507fd614fc08eaa0597b7ab40e835407dd36af264499b34091038766136ce515
MD5 d475a93cadb458e256a6c2a64c57370e
BLAKE2b-256 677ae127b928de426581a646bad04b09145afd5680ac4e65d77cb66198d1ef2f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dcfbf6dae315494cae43dddcb0cebacef80adf207613c8728069b97647d53f6c
MD5 b466f107067be77b8076f3eb848dd26b
BLAKE2b-256 014c842084008ddc08f5b1df1ba2236bd030be13279acafc9097e7b605e4f775

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 dadd84fbdfa4bf3f788467b9032c223074be252c1ab35fa6d4a236002ae9eb1c
MD5 20cabeace2a5204c3c3ef32a33c1a243
BLAKE2b-256 a1b46524463d53fcd1da04e9ef8482d10669955e28740ed0c66e8cc5e7858734

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3bc40defa215964d61812a9e47063892650c8e2c938fb523c21ab4c6e02e3e0a
MD5 0dba9b8f8930aa10d208d09d26dd8863
BLAKE2b-256 97bb3b1da98947f49ea0b516ad42459fba400ef6f424adea1f81e35630da5250

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 aa619acf303be1fcc28c29352392ca174784f11e4f3dc6ae8b3fea39fa5c52e6
MD5 c8f039a7243b537f1ac8cc4aec082bfd
BLAKE2b-256 690d096861c3ddc2c562e9257842ac6a1c13762ae2df22a5d3b901b035fe1585

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b08253010988be42d5e538457a4d4e1019e03fe0cf19c8e2a5fd41b504572737
MD5 182ac1d3965e3ccb3dca903e7b036e4f
BLAKE2b-256 69cb1d320129d7d91d23840e8345eecf0ad449c8293ba827693e2833af7e7b2d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1efbd6ad911d0b15a8beb23978bc41da44236517b301b35561feafb4c5a86994
MD5 23b57b01ce91ea6e744f37cd0a453ff9
BLAKE2b-256 13604b8a971668bf99bb7d30743273fd5387a1c8d028a0a2cb88d3fbb3a96ee8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 96e921e1293907403444cc6d7202fa800b6dcf072fbe2be72c58e3dfb1418dbc
MD5 e3517a81c5f6595a6050ffc14537d66b
BLAKE2b-256 ea9173e13a3b813e24c9311a0d11f29edba1ac9a2d2a8c784198e429f077791f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d43baf1b573d6dfdf23f8f6f627256dd65ef89e6dd8c28fa4e170de43f052c1c
MD5 58d0fe524f8958b0a4c2e6d49f766233
BLAKE2b-256 0059c192c4fa5fd6811db052cdd08355c73e047c4cece27f3a0946c189595418

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 57aa87967832d382f9ae29cb6f1581c4c3b7cca819c3f5e1701eaaada006f36f
MD5 0bb0bbef7f0c4ddc412aff0de23c2261
BLAKE2b-256 e4758409b12e65ebbbef5494479f8de4181992fce2777552c971ea7c874c38d0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 edf005cff65c1301efb3f347e1eac9d5a5eb5efe1cb52409f88ab37d2015e42e
MD5 41317bbbd3eb517a5b315a81a79f6d28
BLAKE2b-256 b876104b574dc9296e5efdec61664625ef2d7b695cf03b74700ad12aec4fdb2d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8cc0a14849bf241532cb438a63d2c4882301a29b3f6f660986ccabedf361bc8a
MD5 f4fb510e98b6220509624e35860d9d7a
BLAKE2b-256 d51855292623a3346d3b75ce2c3a382ee99c47fc170c4919ea119a5c97db78a7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 83fcbb6837b1ef112d2cc501b6a690990936140eab850a64739bbddb3102cc7f
MD5 ddea977b6d28cba7a25aaf67f79c12ca
BLAKE2b-256 11ef56fa36001efdf802a86244b59cb290e7736482741ca4817f262341d2dac7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b2ee58b0210e8b358513a63e137e57a63cf6ae9ce5ece928cac3a77879987e7d
MD5 b31560d7d91692f51c2b32290d372d36
BLAKE2b-256 59cf957d8fa3dcb3b5c7dfb7c2419302b862719b03ac8c99868b81192e3ee4f6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7af20238afe760a6450735897002e4560fc724d5f241e111615361cd6d6d87d9
MD5 a1a2fe21412d6179e298f4bb2dcee7ae
BLAKE2b-256 63a3f18861c6cae0b48891f4fe85dad5e5b0e40b0db09939f4dbdb7d2ab2b4bd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f640d098a023d5f0452a6fd9f42e941cddabef57089d96dcb5a3ed030e44ca34
MD5 6bb1127fe19476f392dc16302720471f
BLAKE2b-256 bf079490275b6cc849a4192a15f464009ede923ae0b38a339130640aafd1f18f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d63dc2b2e799c73957b84262e179fc423a2331b63b250e22931457fbf8a2db49
MD5 a044bdd4f70d3535a99807d2458dbc70
BLAKE2b-256 8bc540a922cc2ed3a8c9963c1c1bcd7d7675aa2c6bc2a0860f6bf7bdb00d1cce

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7d0fa1d90ea20ed0bbd1756f3cf952e60b8cc21272751d71add2d967c65015a3
MD5 7fce26bdb1448c856491f55b9599b7ce
BLAKE2b-256 f45b791aeb4cb44a2ada75213e353c3d42012c6b77c100cf57a8abde3ccbf1eb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b25c8fad29593476a990a313a259f2a3d04c4bf59a57be360e008ca0c3ba9756
MD5 80c93d8737790a24263063c609c18173
BLAKE2b-256 d2799ea22e2e81b6657608bb89f1d9fdbd49069bfedd95af6fd715147032a8c9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408111721169663-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ec9e1c7909de430023b3f09f2f47718798297816ccdfe53aa5b72df18ed87d5f
MD5 1b7e28addd6238f3b2f5de368435321d
BLAKE2b-256 19e7f76f0a97dad84a1fc86105f587715f3faf4445b375f67a4996d3a9c024b9

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