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

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407071719384100-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.dev202407071719384100-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.dev202407071719384100-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407071719384100-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.dev202407071719384100-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.dev202407071719384100-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407071719384100-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.dev202407071719384100-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.dev202407071719384100-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407071719384100-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.dev202407071719384100-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.dev202407071719384100-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407071719384100-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d3b0550f8f2c8b0042a75d7c43dd47fcb9a38fa1d4ed004b1f819cb172c2d87c
MD5 391067cab8bf8089230c1f9d3fd9f688
BLAKE2b-256 625d1db99528a1ec185ea6bc716318cd134d5e81bb6f3b117dccdae07d16cc67

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407071719384100-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1b8cd1934130cec58e134615bdbb40d4f5d62b1e158ef153bfb2f81a2a40d485
MD5 62a7a8796087e166fd037fecadec0593
BLAKE2b-256 98821b729e1b7f48e44a7eb55421624e8a47e726156b05877e58f9bb2812242c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407071719384100-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6b2cc1e2cfc538199487e2fa8438cb15969cd0f54d115744cce1b997a2311eac
MD5 bbe52b3116bcdc74af295c2e6fbe1361
BLAKE2b-256 54bebc1b740e54774629fe915f4c924a45467e7c502374f0d12aedcc54796db0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407071719384100-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bbfbeb6e6e877437eec41d9756cd9f97549df405d2502d0765b70e9a6a4ff931
MD5 5bea23f6f3efc869ccdaaf37fe0c3a6d
BLAKE2b-256 8123533a87c80d68474d199e6ad860870597625996af406c7d1f5d7a3c8cf470

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407071719384100-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 36eff82667d8b7b86ba7712becaa96a6c59e9857734423706e5b0c9c2aa5ca25
MD5 e32318b8423f1d570ef5c9063e590cf8
BLAKE2b-256 5a767b2fdac45f74752073f774a8c5b85edec824b478837ed6c138f70bbb0aa1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407071719384100-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c02e2aad147b2de6853e506cdf9ad811f9ce111da99cb571959720cdeba3666a
MD5 37f30c29c4587dbd0ec7fbd2af79f7fe
BLAKE2b-256 75bb49586e5f5daa1f1ac26353ff16b6b78693618acb7c9011dc687de70b0dda

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407071719384100-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c96ac81b8cabcabb6a6839c32fd3b90ecdc11fd9336d67384af85361f122733a
MD5 00b3d214d7bec2c61df64fb35d4529a6
BLAKE2b-256 ed92f75d9d24042e2df3870391629660c3c94c7807958a0275e4bfef4d1154b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407071719384100-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7044d1b8ecadac9fa9e17993f58a93ee6ebb5373a40a27f9ac92cae8e61f56f2
MD5 005f3e7661ee259cb9a93f564e228292
BLAKE2b-256 ad17f1c73049ac7ba436e3fa363b695e800cd991e4c37c4c3053105f1869b4b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407071719384100-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4ed91b0db7e833337c0486732d9032f0663153886a2556e3604bb15fcc906a2a
MD5 39aa1febb37b40cabe68a6914079d297
BLAKE2b-256 bba7f1f1ad60f7ebb9b4d229eaf416fe12a02afdf8e9c0bbc58230930c7a8f3b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407071719384100-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3ec4ce834526db4eb6838400ef190fcd1b0f4327412650273e1842e10e9b2ae6
MD5 a692ff18b591dd20c0a2d319dcb8934f
BLAKE2b-256 12b7447cd1dfc189802f982ee7c1e74ffae64994dcc693bf7ca1a1b0a220c095

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407071719384100-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 dfe6f716af58ec3c90ff7c6979bd7e6c9531a3237834358ef4d6c85fa5fb17fe
MD5 5cc0e564684948931981abc2a70af5db
BLAKE2b-256 292a02b9bc499e8e6f6907763ce5b1dc99881e6e5d3f783f5f4af85a47baea1e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407071719384100-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4b2ee46efd615a584c4242cca1aafae0220f190f95f5a80d9ff3f55d11cc92d2
MD5 c63bd8b4849e89c608406851106fee59
BLAKE2b-256 9361def1996fd39dee6380e6f15168db18bc79e9adc4de05380e8393ba9bfece

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407071719384100-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1ae47ad0d6b711ea1d25c42cd793904d57278c05cbd34166ec3e640f94b5b967
MD5 8e948f25bc80b8b792370d28a5415809
BLAKE2b-256 88b2540ab47e527428f81bcd7e6ab5eed1c5ad7b33e52ca3aad0445617c17caa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407071719384100-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a28ba3ffc7343cff85bd6ca64a78fc6968ec6f04df1e607c8991e32fc8bfa5f1
MD5 f87c9207f6b71265da45bd20bd271140
BLAKE2b-256 e01735578f7e61ad6766840a4a6110efb72ba84635e2e15a7df1dba837b787d7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407071719384100-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4dc6c0c086b9c8e35563d2c2b9f21a885f38a8f09ea49aeb7764780a89586c40
MD5 21e449a9035bd0e37e655e0b696b9903
BLAKE2b-256 8c63e8b476d3b7aa32a0afb9c3bdb3b92ce48bda030fce6539f811c90845eff0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407071719384100-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 0f6d884f09f6af182315990fd3e74c62ac528c1224255d2e3cdc40b30cac76b6
MD5 f5cb56c78a3f69d6dd6b3621866d2fd6
BLAKE2b-256 5c3e9123dc70c543c3714b4079daa8c90ca655907b8ac44fb4125e30d8af2482

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407071719384100-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 927fa0692308ccb3796478b7ff3e680a1ef5796480f4cceb66eb9912711ede8c
MD5 0955a9018615b93fe3f8817fcb020d27
BLAKE2b-256 3a0096617b21640d6561ae028e68a7dced76d498c479d11707b4d6f93ec35423

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407071719384100-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bb77681654945cb9b3e53645ce20c55173d283614666d9917a4c2c7a647581d6
MD5 2242d17eeed7df5bc2cc0280b4f2e502
BLAKE2b-256 45d457f14e8362bad20d2c4a5c4e1fcc195b2d2ef777725620a66b2eb041ab2e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407071719384100-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 527090db5fe42cc15003e0e7d01996776cd92baa8cd9d5f482fbc6583e58f38d
MD5 72a762acc944bb9d87b442f10b50d7d0
BLAKE2b-256 9c50c9f751363393733a53e18d817781886578fd154ef049b8534686e1734319

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407071719384100-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2900e155d9834105422c6869c8c91e070e68535a86200acb2e05dff3fd7787a6
MD5 dc9d6d8dbd4fe19ec5907f9c7273e563
BLAKE2b-256 8b3ffe85189d6f0f7f085356d956888fd661b0cd89590dd845761320e030c758

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