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

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.2.dev202412111731932516-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412111731932516-cp313-cp313-macosx_10_13_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pyAgrum_nightly-1.17.2.dev202412111731932516-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.2.dev202412111731932516-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412111731932516-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.dev202412111731932516-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.2.dev202412111731932516-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412111731932516-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.dev202412111731932516-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.dev202412111731932516-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412111731932516-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412111731932516-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412111731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 4d54bb5e078cafc4f665a157d6873f06c4ef6cc9a8ff5d6adc31b87df9e4d7cb
MD5 35235a5bc81519e359aab5fa33390fa9
BLAKE2b-256 2125e9cd60e40f66ec02dc3c18e9a8af8590f8b39701b45976084acca2534cc6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412111731932516-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412111731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4273e54305fbed79fa710f0c7e6c7b9bff09800f9bec9144dc25ef24bfad1fbf
MD5 5c1895e7c878c70067f182d6a7e2945f
BLAKE2b-256 c0a2bb798eaf45fc36e947555d415de625e48e531342e4150ce2eb9596a4ccd1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412111731932516-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412111731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7d5241cc120ed1340db6b72241a2a716f69e72f526b112459e8b5806117985d2
MD5 dcedf9d72ef28275f544661cf1aef282
BLAKE2b-256 6857af5106fb47a0d233ce681dbef6e6626f58ae8b6c4d683e1a477a1bdb0f32

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412111731932516-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412111731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b4470073e2c5bc651b500a659eed03f64ce5669a1b9753b583afe1580986a82a
MD5 3f94d13f51d6b4b720738498bb9214ae
BLAKE2b-256 192fc6ce9d1b8993c4bbd4a1de791b892c5c627b40876c22b34075c95a3f8d87

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412111731932516-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412111731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 a84c0660c927d2f9705ae42fdbb070adbe507ab1b119a08298c734a392aa6d46
MD5 5886d0b7edb7f1ca43d28907994917c5
BLAKE2b-256 b3d7200b24b26be04a6738ea1ec8823276198bd16e04cb4b54def3c2fe304982

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412111731932516-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412111731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 de71db9e054e438c3139406cf2494c8145f7a653b4954fa65205001d169750fa
MD5 dfa25aa54932def1d2a7c1f59cbb1e4e
BLAKE2b-256 5bae056fe717234bb9d4b8f83c6fde2f812d69fa693dca70c1cfdc4ead92e879

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412111731932516-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412111731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 389c44743f151f74cb839203cc7cd5a4d905cc150bf3c19455fee71a71a2fba1
MD5 92e62cbe27af1c747ad783973b7e4ea5
BLAKE2b-256 1bd493e513ffe535ba52f0a195bd6e02bcbadfc895748bf40c81d2ef0784d7f0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412111731932516-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412111731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ff590a840c2ada8faf8b629f391dbf8308a05f6b2759dbaac8313309be1c5cb6
MD5 555dac8afcffae6e7d04f8b6259ed0f2
BLAKE2b-256 57f155d26a70814b18430efd9a1a84d1673170c114d1bfe425464d623fae39ba

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412111731932516-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412111731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b65a920ed8bf560e30029fdfc8c9f89aacaef03dccee96a2eda46d1afeda5c3a
MD5 9d5ed795b92ff68ceb0b39375f1ff9a0
BLAKE2b-256 2353f5183622dcae37da1ffb78b4339a064961a1f48cd711fcfc7fa4188e0da1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412111731932516-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412111731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 65ca4ca3d0cb8c0f7928a0102235f6a518dd75cd4ed0bb7f8bc53a17d45987ca
MD5 48bab9ca730d445d38e38cbd03eca834
BLAKE2b-256 e8d724c5eded6bacce9954bb4db44024ece7e25283479cd5b76053593a87d41b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412111731932516-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412111731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d555917b63d1b84caa01e7c5a1b0830860dd14241e34aae6982f62f263b45fa7
MD5 efb93b18902b8bce531b0cd7b1704d3e
BLAKE2b-256 db27398bf1f95a45b4e2a4574b0afda26bf4c2084a69cb9cea9791a4bd2a779c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412111731932516-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412111731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e5894076aa7b3d6d3fb8cba1013cb8f906e1e1f63f94086058041a98238e68b8
MD5 055261c56a8a0cb6148473385fddc284
BLAKE2b-256 3767c509d29bc95eb5f4921870e5af2072bd85b0a915aae5141f2ab79f185e0e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412111731932516-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412111731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 80f9e694dc20d7b478e1745e7e2454ae2d7a079cd8a95d93fddc39fa4d562ab6
MD5 d6e7a0abc51fc88d9f5553c573be0673
BLAKE2b-256 ec9bcfcdc51165d8b6c6cf47479881ec15a22718c53a9daa775e271ee922161d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412111731932516-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412111731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 820cb4b4205b70a4d493348eab98126081fa86071891e1431e4eb7cac803ac2b
MD5 88ab4fd139eeb41b6b27c2a992635fdc
BLAKE2b-256 a6169bea6853b460206a517ecd19105e1e542f836101aaeabe4bbb8cb3d9fd30

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412111731932516-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412111731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 faa283a95de6a7d10a356d649ad865f7d281f0d37e0049b5547c406e26e02070
MD5 fb519770d8ad3d5e9c64eb42b547baaa
BLAKE2b-256 91d9c2c11f295bcf004c671308d40249f2645bb3599ff2ce571f9c53839c6108

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412111731932516-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412111731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 2b587505b9e7aa679be46cf17ba194c48840f5ee6a4ba2bfe67e704e9b726fc6
MD5 af892769f6fbe062b8ed9c1337e65bf1
BLAKE2b-256 c427856ae29b09a5ceff2cc39cc6ca516a00d50bc1e79f29127ba70fc5e0b46a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412111731932516-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412111731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a16786a6fcfc0864f359038485b3fc99ead079586dc1ba698c74876c0165bf61
MD5 14dd98eef9180d2a1145b49a3a8bb8b9
BLAKE2b-256 e6c8f3716cfd948d1e649d4578dba3bfa0695e166e2cb731dc89d78e4a732003

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412111731932516-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412111731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4f0f4b480fe0acafb945ef7282f5f8f21e90cd75fdc6682a0b5df6a4056653fa
MD5 56d44b1b8d683b0ff9bc9250682073c7
BLAKE2b-256 13457e3a773ebab56e03a3b362e5cede228a7f80aa0529511aa3714d5d2ed5a2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412111731932516-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412111731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cc736c813ed21adf5f78d183fcf856a4ea7146aa5229b52a3d290135f0d69bed
MD5 f0475308dd7b7d439f1ba641f4f66053
BLAKE2b-256 01cf1603c2395f7641ce9d739d6d19697842aac775ef67d301cb412c43d4f1f0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412111731932516-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412111731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6b8b48c95b94d6b763b943caa69a2c66af841536f37676e24ecc9ffa1e8efa5b
MD5 57fc95e8c1a2ef358358d5294de46591
BLAKE2b-256 66a3845b91684f72b6820b7836cc1633856356d680728b298d3b31ec03db3788

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