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

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp39-cp39-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 2a74cfff637035bd21eb590660a26ae6bf3d146396377e35c25050086da95c22
MD5 5598f5e38049a29709028d40f67b3987
BLAKE2b-256 c8c69f5be907de7cba2e81837a303426f0f720f3bc50002a0647f62bc6bf7b08

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 434772779527002a4bd3681953e9fc8f0d45dad2423ef4bcf7db0dc75fb353fe
MD5 e2d3e0caaf81e0a891f47cbba5f1e977
BLAKE2b-256 25b67988b707c78d29596a6b006ab7be0df327220e6999d5042dccdcbff91dba

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0b3c790fa3100db5f08dbc9154cf09d5ad22f725eebd46a00e15477625b0e8cc
MD5 91ede1cdf4e84aadeeb0c3345b7d819a
BLAKE2b-256 a1c41f362687fc5485e9baedb3585107497b8fe1290dc4b4fa9cb5c9f4164dcc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e03befaefdc999708758103a8c427d8573b58acbc4cfe4bac5a70cfdcf251631
MD5 82967d2ade078fd23e5a3bc6bb0735a2
BLAKE2b-256 8b68cf0673ca8c8f61b2044f639f0b77fe40df1012330755400373b3852af890

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b7c627f525710a43ec30f20bb64c5562d1915dc06d246cc1b8d1a39d930ea9c8
MD5 0096d8de503bc7c2a6d922be842a9c30
BLAKE2b-256 7e4827a778d67f511cd34a3376570a0b6a8df2464ca453bfce48700c9df3804e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 fd7bdde1ba4105ae29cb1d6935aef9ba5a3f195640e60d6935a7782035f2d997
MD5 3a66aa5a0f17829baef5394758ee5b8f
BLAKE2b-256 809f4d3be3b673a2959ec062d0d875841db30b05a8be3818e2529b6430c391e7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 74314d95ed3aab044fb91854c1097a29ea3e3e7427432a09f14999b99692e81f
MD5 1d2e638e69903e743a21ff2da3fd2f43
BLAKE2b-256 1f50fe73823621079d8105b2f200cd48327a575d33637233a5cb2cccde7e552f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e0b363b3b8a6e6c2607ba4eb624dea719f2c2f472617e26b4c4bbef67d795de0
MD5 cf4a3e231aee924be37bc36cbe36da27
BLAKE2b-256 e261b76d4fd97831206238ec3bf458345ceb8e9ee7770f76afb1be28c5e18f77

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2a4a6ef83cde0bedb637b4cb7d2d0f55785890031ebfdf49faa9689c3f8b92d5
MD5 6266164b0caba23be86d4bef40e29407
BLAKE2b-256 69fbe8abf719101f47f6e5b9881197f005f250e1fc661fd48426a9a37edc081c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8f411b7e01642e6a2e2ffcec397367fdb712d979be28c375110b3646fb51fcee
MD5 f15ee888ac6ad4e4be254534b011b66d
BLAKE2b-256 a572b04135254e6a1ffd3e18d171320d7921ffe8c55bd2fbee116c807b4ade5f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 dfdf608b202290cdffae02412b451e8c20b5e6b2d30f5d234632ca34f7f92bb1
MD5 8656af7f50dcaedd33acec86299e68b5
BLAKE2b-256 23d5f0ce621a6caf40bb4819085e4fabf6fb82cea4554030909d5d85b248bf08

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 70aa553a5c4574e6a4d61de3cb4e6a189953fe0135b970f99fc0763c75138ce9
MD5 676adf81e0932022308e15aeda289ef0
BLAKE2b-256 b818002c514b2d47538b57e212451f34666991fc3f2e71124a930028d14c5e8b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 cfd701d11678b6006670ae5de937336246bf6cef90130c71789917334f9dcee5
MD5 3b2e82f7b9513d32b7de4063b06cb4cd
BLAKE2b-256 fcb8c7d68f4a0fcbcb2fed631087852f2d8d3e4feba607fce222d1395932481f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4c936388f89b214866d6fc78fe8aaa3065e10eb22ba500f7d19209488fe2f41b
MD5 6abb55c3eee42a563dfaf713b57b227e
BLAKE2b-256 794889389320c136e157d8b77e94e8913aadaff2df3950a8e6dbc054554150e3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 fdfce36e9db3ce65aec882ac0ac2973a992972acbf3dcc65acc0ed68e73a1dcc
MD5 1d671b6e9a832ad39f8c27f67c0cc960
BLAKE2b-256 8bc57a03b1f86852f4d4265d211b7c6f5682961f5d34c5437f6ed7fd5efd5bdb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 548008711cbb90389680267863a0254e50f32032ab462c5adf3dad4431766c6f
MD5 c1f6bc95416b193f5e299bef5ffaf524
BLAKE2b-256 a07d0a814479096eb366175130aa49ee1df1c1b74555b10bd7431470b04085c5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ef3d1886b44028ad814f788b3c79abaa246d31861fc2b828ee076b869169533e
MD5 b070c6a56f69c095d03bdfefa1b76c75
BLAKE2b-256 0bc09b1a20472e21a5ed35d9fb3d28d596431b1e5ad334c9796e8b172c78ea62

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 cecbe106c097b9c1e410a8362fcee2974b517fc6d91265c5951b1e8c98c962e5
MD5 d9a203dfbcd9bc7ae8fbba68664cff56
BLAKE2b-256 a042c77fdf632758196db60957cd5a018aa13e7c5cecfc5b6223efbd576019b2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c832793c6cd12a057b641c02ee299887542a28b0ed25f22de40899f45e82c835
MD5 51c91341e9d87358e8eb0089ec34e667
BLAKE2b-256 1588cce391b73539b498574972b0acd8fea54d1b3e34680f8371d62246caef07

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407131720623864-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 cd39f242712b061cae397c7b61bbc62079f187db6c39f39f8f1cc213a89ae375
MD5 52a75c4f89b1a5b1a34bdba3ebbdf153
BLAKE2b-256 ec3ae76c986baa31bb768ffc101d207d85b0910129f6c915a951600d67759d08

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