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

Uploaded CPython 3.12 Windows x86-64

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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202406021715182293-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.dev202406021715182293-cp38-cp38-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202406021715182293-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.dev202406021715182293-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406021715182293-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b083c1c467c584a1b960fcf7786b38baaaa8cd0f5fe363fc0ffd2cdbaadb281a
MD5 6d440390a84a2f160336186609fe0136
BLAKE2b-256 18d26fa983b7392e2b48af3473132dc7de35bfcfde93dee792f4f5cf05145bc6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406021715182293-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b8a63955e3d8f149b64a364f0b1946b75e3a29c3308cd82edda8a6265b333103
MD5 9f826e512360cf4552a58fbf1d735004
BLAKE2b-256 880b0fdc1a79ae4c4fdf7ea1c819ab0acbfefae08896f0ae302708287b2cf00b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406021715182293-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d71a7cf7c2455836da25531e7339db68eb5b0b32a64f7cf948ea3caaa993fa4d
MD5 6d22c537d34a473213ded2a142037172
BLAKE2b-256 9316b47b1147200d1416a4468b53134a129c881c8454591743f793ba8c6eaf27

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406021715182293-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f252eb49052b9c90057b9802059cb8dc50e7594506a39db8ff698a0878014073
MD5 e9a7cc0c416b5212476ac39edacb6f81
BLAKE2b-256 bf74157fb95d8619e64cfba7e9433839ad3405aa6613b3824df901d0ae2d923d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406021715182293-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c3712e3dd6d4009d08827fb0cb8f4d8638b82606166683a51f141b15ff5af009
MD5 befa9a6bd25dc5db8cbf8aaa425fd82b
BLAKE2b-256 aa60b275b202da2092c6b8829b0e577d0fddb11d2423477a495f197ca970a778

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406021715182293-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c5ad807f7a9ee296fdd7e45c525ed6749ce4084f386919af02ddae65059d1a8a
MD5 96646ac3e20f53222c645c60e70d172e
BLAKE2b-256 e92b87aec139c70e6a8fdb768566066dbee30ea0a452704ea72118c3fd55fc17

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406021715182293-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b847d672e5d1f4f61655bf6b401ae6fccc66b6d973c17f6b275b6039e742b6ca
MD5 aa52e1ad38ca0086068ccb268e7efd78
BLAKE2b-256 f945f46ceb109c94a3fc5302a6727b3df80a1c0aef74694cb6d3893f0872c2eb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406021715182293-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 50e96f6003c4297911cd03dcba2db7b8651f9c9a1046008d6af0d61eb81a32d0
MD5 076399f59ec89339568a591edf713689
BLAKE2b-256 232b827ba24bea4b8d9b27b77b24bdeee80ba77386532c164f2d92f273b4dbb7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406021715182293-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a5aff19474b57f930ea3eced1c989e1ea1468ee7cdea35695471388f1803687e
MD5 81976c9b8a615f08ab9b576c9fd9ec3c
BLAKE2b-256 880eddba46156484bae515b1d2b49853de7e7a28ee9869787d4a6137acf6dde4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406021715182293-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 784d8dfc55be3e6ce442a9bd8d4a5093faf461c26bd54f823826ff8dadd4ad46
MD5 f8d203cd7b74960cb34194cb35232d24
BLAKE2b-256 be09b65da37163a10bf3a8fc33e539d38784e415c5362c9ffa8a867395f7bb54

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406021715182293-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 fd4e6ceffade4a938abcef5c69fb40c7911ceb66a7eba0a7c6e894c12b729b8d
MD5 bb7f4ace35e0195beb6720d8b4e55c4b
BLAKE2b-256 1031fbeb4a4961dba234990c15faf4ec91656abaa9e95fb6f7f66f13c93a005c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406021715182293-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d1cc8e22b529f4ec2ccc326fc83b086df981dcc2802c97fbc3b7f934187d8768
MD5 b6d7d0fb0b6cf1f8aeb951ed3832ef76
BLAKE2b-256 b40a9f9d75e2ab4e0f12303a676a2ccd1225ae7f9a1437bf8e542207b7a78e01

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406021715182293-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d4861faa7c0be7195e5bc249e764d4647daf8977747cbfa49cff2890d90223c1
MD5 c28af892a318fe4b582eee0610c0514f
BLAKE2b-256 9d132f2684ee8c88db63a57fcf9d034d2599acca7fb9445502de3ddd65307e5b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406021715182293-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7e111b375853bf800681e478ca06b3635fca5e8b3964724f81a81e9b12aadc06
MD5 a88c866d8c89c92b3068e002b3c2f638
BLAKE2b-256 0bacb2f7fc7c9f02f698fb51a07e5a67574844b0b07620287f5f809788fa9e12

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406021715182293-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 25d46754d283934375798e86d3739d7d3f79e4ce04339612af044855fc161b9b
MD5 fe81825ea75fd8fb9feb6bfcef1275bb
BLAKE2b-256 f79f38ed48f5555fe2d6ac66a98de962ca988d5fb6541dd736499c815e8c4494

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406021715182293-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 7e99021b5e3a0a3d9c009b6f98c163f6543fadbbd9abed0081371cdc1d19a977
MD5 fabd0d880bae6ab782f837b8e723b3c2
BLAKE2b-256 5a24488f6f8b41b2eae99e44b6cb79fc9b4648ffc87e3db4cc8858e6c27121b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406021715182293-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 55e54f1baaf39fb93a0ce78440b5fe5b03800818dc157ac4eac3c36eb3ab0f52
MD5 5a0061299243feac83396630e33a60f0
BLAKE2b-256 e13a5284544bb9c84b8daafa507150655ce8806b7462f029a195980e59be5a62

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406021715182293-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5a7c5e23cbe636526c08084c6c4b38547c8986bd0808af14230f59c65c641d19
MD5 9320b2b062a95717111e2d35c381ed0f
BLAKE2b-256 aeeea6f2c4038f2d927cbeceff5c9e4f7208066bc5e86e2ccf2361638170ee3f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406021715182293-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 05052f98a74c04012f77c0d13832695934d496a48a1a243669f23abfb4af8f62
MD5 23fb074edf3fc646229579706775726f
BLAKE2b-256 587440d0d55b94380856007083f2fa31933a7f91da5e24ecaaa4e9711ad529ba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406021715182293-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d8f318775f6de790e936edfebf802bd892b0ea513d02c4093cceef34c29911aa
MD5 519fb9d14e2ee337cb30dbd4515d1308
BLAKE2b-256 7b3b2fe85da41c7af3466790499589c8fcb674444ba57574460b7d25d949036b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406021715182293-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 d5046211d4b2246a15abcc6b9a27318502b519346e4381cbc4a7fd4dae15a51c
MD5 e5dd1599cab545f9f7dbe922370e99e9
BLAKE2b-256 d6bb9ef3b4651ca598491000f143c513387a178d713645394516d8c6e8886e07

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406021715182293-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c4e5cc839721af71a3967045ee982d5bb1651f13f297500c2919bc4529c02295
MD5 e9dd9709138592d817859485e77033a7
BLAKE2b-256 a60e757028d52a2a3265dad8fe9e98744339958de7a8f0ff72a700594c3646cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406021715182293-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 093d84379a2ded9556d6f621e6b0fdc2c471dfb6b06c998b758f078c6f993455
MD5 13498b0fcc15f73d5315263b1f707977
BLAKE2b-256 6f4ab766865e936efca98551a6c911cd40f70fac3b56b28d899001a7c3ca058e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406021715182293-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1e0398a516938653d908bbfad16a03e206d2ca96e7efe9a223f6650c45ece8d8
MD5 b9295b274d594b8a5fe70432f0e5a056
BLAKE2b-256 a4cae59dcb4e39742a1226007797d7e5ee218a58cbdaaa9b57f06f68df54ea69

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406021715182293-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d1dd2e55a95d366533f98dbd9fced5661f3aa8bd187189d4f2428b2f0745957b
MD5 6dda01d4c4ecbea0f86b89c04a66e785
BLAKE2b-256 0b9bc4c26eecf0ae0295f70fb4aeb67f46919532d2cb71513a8b1c5d31f8731d

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