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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412051731932516-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.dev202412051731932516-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412051731932516-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.dev202412051731932516-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412051731932516-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.dev202412051731932516-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412051731932516-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.dev202412051731932516-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412051731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 a5dab4128b24c925ead2f325fdbb7e6cdfb9f8a0af886b7fc55a27500911744d
MD5 54522df42c364eb9a49bbfb0cf7aa3db
BLAKE2b-256 9ddca2adb1a3063a3bfecc5409fa57fa057aeec914a3128161301b2bf3c67112

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412051731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d05c34166a906f29711995d91255c036102d0780c12ba7e6c2fb4ac253a0fe95
MD5 450199b9129421fadc9aa2f3cefc8370
BLAKE2b-256 dce9718d23eefceedd755bd5aa3048b948df3b51dee8c3f6d3bfce250934e927

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412051731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6999072ee3d6cab45731925fad107c940cd152947d00ddb3dfc74ee0a788c658
MD5 70bf21c2b2e65f51baf37442dbe57d10
BLAKE2b-256 4001489f32ed482b993a1812b700c7409ba8fd5c4f92917cec8a8a30ab300697

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412051731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cd9612440d1e17a00eb5507d85aa9faf15c1942dec1e870d3ef6486f19be1dcf
MD5 06aeac9f30129239d2a1d8cbc155896f
BLAKE2b-256 1ef35b6efeef5ad26e5ce2477e63aa2c9b6573b84e5a37d8aee63e98e9a71392

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412051731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 60bb838176e7a379736bff5dbbc7569fd000bd5f8e0961473acc9fe284887c09
MD5 076284726ac08c792ff3dececb57c2c7
BLAKE2b-256 3089d68abb67e8e2269efbbfe624b4a0581bf12c5b9c1f8a8cc1c4d6dafcb974

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412051731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 f2ba16e464d987b1d773864601f9d7d192ef58a4db8cd176a4af109d0c5fb151
MD5 de7fafd8adf3efbc624b928c77b25ac8
BLAKE2b-256 2b64f77dc31ebf2d6090c6376c82e7f22306c446d7c4e83c36010ed34ff9dfe6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412051731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 525b566b65efca544faa458fe923d207f4e126fc0521f1070d6b77c9e3c1b4bf
MD5 37be08664af5d007778b4434dc3e737e
BLAKE2b-256 2f539f106988a13af136ed678d42edca34abcd415f1c4539b67005069a04a592

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412051731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 cef94bb24a2e9b53d817ee5ad40ed3c5ccddaaeb553a580a031b333deaa9e506
MD5 0e523b0275a4d453dad5eda1e415ddb9
BLAKE2b-256 da8320328a0fba9122160de0518612b5e111a2f457df92780a797a28d4984bde

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412051731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 937dce6cb529f5883e027df845a58b99193d7aca913a283eedbc0fcd32650d27
MD5 8dea09a43372a65c4a95fde4d88818b7
BLAKE2b-256 a3099aa4bac1f0a853488318afddca48e82dc5ececd6b6726e8161b0d3d65b79

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412051731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bab9438b947209cd0efc81bdbbbb7975432857602326406e0bb7b2771ab8fcd2
MD5 4735f43f3258fb7893fdf0f0cc4cb5fe
BLAKE2b-256 59c67f2ee9a1164ff528758bba26682b6ac4f4317573e3c6f38846e7854a622a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412051731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 4acc1df0cd89f8f820420dbed4388a8441506889e290cf43d4d12eecdd54af23
MD5 74f669bbf4d91c5dd934a1f9c430165b
BLAKE2b-256 ad8fef698f45658367a5bd50af5766f6e71805d8a17b805eab6adb64f6c1cdb3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412051731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 28cafabf5cb2826d67c1d8421abd55573b200387dac75e0a70d8d30902c00b7f
MD5 c96e43d762803f1b90bb638165bce4b2
BLAKE2b-256 f85209411d01923a19ff66baba4bcd06bcc79349f9d15d10c0928c1ad72616dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412051731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 35a1e71e4b5a199980584d480deabfa726113df74ab85d1d0789b40c0fb85dd1
MD5 d262ed1fd12ce1bd8b19cfdd2938db13
BLAKE2b-256 763a1b936790abd41b490aed2ac2a93b645a30102e23c3be1605a7b59ea9738e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412051731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c5d1e846e0dea8d026254f9394b7e7f2200520ea0717c5cbb1377320b4fe33c2
MD5 94acaa498736bf0b273cc0c5a1b9fed7
BLAKE2b-256 9b0cfcc2667d0fd8d89f3b77252911c42d1476aa8cfc770c97c533790f9a01a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412051731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ba08995c52e0c0562cd504076e878764dc911d71f97b989835a877b12989e327
MD5 2e0810ba1a3d87af1ac387332ddceb2d
BLAKE2b-256 6e5c282c74defe9bf68bb0aa96d059e51c8912a11735a030e562d51798650640

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412051731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e8648024e9a1b1fa5f28d899682b6e336f52e1f0424cb6b43fc4b136cd0268f8
MD5 0c6e9d2c38a4a56bb67b97ebdef15f91
BLAKE2b-256 79bb75235479dda2f6600e641d426277bc2c05d05115801094ad5e29061ffa37

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412051731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7a46e3eb47494c86c4b3c6667d781c4c85473ed71ccb01025ef0af6ca023cf31
MD5 1101cb24a64b321a28054efaec453909
BLAKE2b-256 9b5ab0bc03541fce915e5f24ab855291d93f6090e191d6f28acb17e2731e3b60

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412051731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 866be5a496ee65d397b44b2c7c3ddbd8cace4279328a64ef86bdefe60cb1750d
MD5 4b0a4a125f22a8e9b0b4edf98d068f06
BLAKE2b-256 70037f18de3f1a99828f7801a35cf6679c5fd82cc2b999be72f90b82064d9f1e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412051731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 720e8d531788cf8f3a6ea7520b96e98653015807c0ebc3b17e6bb04eb1777d0f
MD5 2c5ce3a26cc0e893f52db21ef256d388
BLAKE2b-256 67736d34999e519efb16e355cda5f8632bcef34791b95410fd1b7c1ec545d51c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412051731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7bd6abd0c43b6a9e9f54207fc6221b109c4785b75e65fd283c2e4ebfc3cdac51
MD5 c31a5180ecc4f0a24605762a8c05acda
BLAKE2b-256 9d82d541f323eb1cae2df0e4c0ef9473f52d6afec4674085b347a259ec5885e5

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