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

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp313-cp313-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp313-cp313-macosx_10_13_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp312-cp312-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp312-cp312-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp311-cp311-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp311-cp311-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp310-cp310-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp310-cp310-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 be902fee4bf1574b8e80aaec86f0ffed2e2ffca3ae53f807ba20d23834e0170a
MD5 9752b94f9f4134aba62aed79101208c0
BLAKE2b-256 eb875a2477b075cfbd09f63cfcd6e08c46e555ef5707af9f0a94a1fa061186f1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a3e2d2ffabb3b034564d8878b0fd25b01e144ffaa81186451efdc3ab3f9bbabf
MD5 9d79388cdd28a22b5dd8f96cd53c23ca
BLAKE2b-256 63d6a08f7b2f20551b09e340fc4a0d6eb4b85a936dd4a7fb60390e2c1934e0a0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2ffe7b6c584c7d75bbf53738372cc8422973d84edd49e3bddae64c2141639474
MD5 dddeb3200a128243f13b3cba25fd8e82
BLAKE2b-256 1843a32d7ad3cce6dd7d84b9f8812e899f561a81bf9963ce6ee6d95f6eaf8257

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8914411668a8adaa2036c63b505eaa0d1a5b8896978141f30977b2b46ff2767e
MD5 d5dc417aff262c98651c8dd166fc9c0b
BLAKE2b-256 03a28a37361342a49e8cc06a7120b7fbe5ead63da0ef6878e80a66d39ea5fc33

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 0958c775bc28042e233457ad0441335f01af76a357e5f95fe189fc48e8da4ab5
MD5 56c47ad448f7db35d1d1f6d3f2d9657c
BLAKE2b-256 97867d9b740ed04a1094f81abfc8cba1a547af31d021c20d673f2a4145d18a2f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 cf4f5f71cefa97f9c144726214d4848aa9628a2996939aea8e455068cc23474b
MD5 b4bf72c8d86d4fdcf9907b9bb98629dc
BLAKE2b-256 d326f2aa1aff4a70c2f49d9c2fe44a30827f443fca22dea39349445c7ee7921c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 acaa4680ed5a6f95d062a1edfc0897de55a566f8c53fe580664a7f16b2a0d63b
MD5 edc38b1c446aded175a068bc4d23a236
BLAKE2b-256 f2959dfe05193a6ac986e90813ce64632e8871a5212df511907f21daca76f65f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d47aee7082bad5073334a1cd02671f70deead99c473a1dc3b1bfa9a29ec9cf28
MD5 7897f91de7057c152e5cf3be349ca6b4
BLAKE2b-256 a2c93909863dd454ecf10745f3dd9a1c8591c9c2bbef533fcce27d78afcc59ac

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1d6d083f5373f662a59516c11716d0d68bbb65b2e5bbce9df51db7ab6094c507
MD5 ba8cb61d90386ac9de176ba88296e1b6
BLAKE2b-256 ccea02fe698624aa31909d06440c7089c95a57224959aad65f2bdaee95dfc6d7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 35b3243c5c826cca8afd7ba44e2c17aa9250d36491c414c54116f547fb40804b
MD5 575f60581e03d972e40572ca18eca49a
BLAKE2b-256 928bba8ceea97e8dad5c99a28aaffad1ca2f8506686359c5c160b8bdf4b264a2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 21289e5499d8c8ee12531e1c29f23c5a7b573ba6ca62a58736010b15b387c436
MD5 d9b16e1fea146c0329681628c1cf0976
BLAKE2b-256 6c3475ae649a996db1229564e9c5a1c864767e132ebabe609fa6090d59d7adb6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6031d44678e5f8cde16a072addc65c067bdca1732b8b3ee37712c699c3bea7fc
MD5 2d58d053f828439256d46e525fcf9faa
BLAKE2b-256 5e833b4082b9d1130ab4a01d306ade772e64702e6594bb5f6054981869a7889b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a4d53a78f9e9dd5ab8a729b89b51bb3e1b112325c955f178f3c4568c977d9371
MD5 c4c595b1b461ea8b3883458c4ea235e2
BLAKE2b-256 514fea3661f6ef2393bb60e22ce4d1d446203b6579aa2306da24fd8b894f7ad2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 757d32e864fb32b33385fe89a2b72d18ee0656a2bc4be6aec82c2146d9a9ba7e
MD5 a00d6aa0e36b13c34c654a2189da4857
BLAKE2b-256 0ca7fde74b3235de3d31eda63376330130465b37e119216015cf05a88270d8c5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 18e75ac497345efb7134fc240f53c1bda3223e0159ae9656b5e29d119577c96a
MD5 51a0423764f743a53f6e91d270efb217
BLAKE2b-256 8f8855683e0953bf5d9bf633417855148f044066036b11e119e9f0f6782d14f9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 bcb94235395d8268436fb6a7677f20c7a42d69a74545081de5c6417ec647338c
MD5 7600bd92d3992f07ce56e48e13d8f9cf
BLAKE2b-256 4a573eae73a91eea3f7a4baf479048f27672f3b8eee99640090aba68e835f5d0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8fba1920021307586dffeafdf73c5bb19553eb3fd2328104b674ea7efcfbe203
MD5 89acbf1d4fbba7de652abd16dc9e0e65
BLAKE2b-256 e966706c5f94a43c88d45c67ea996bbb318951aa142fc9e66441494f74f5bcc4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bce03dbf911f2e18d4037434a62c478492296b838f6007050e21686cd51e9241
MD5 a7c5422e22d6681be337708d15451e92
BLAKE2b-256 9bd088bc9f95215a7c8a530a9151acf21dd54a5836c82b81c69cc52334f483fd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b822c8569df89165998d8cbe2e78e8cab00e6cdf30783ae074dae972710dcdcc
MD5 979f36e970ded984907d52b19dc179d6
BLAKE2b-256 f110f7d033466ef7e46fcd6d4d2ce52a7b8beabaef17ce70804ebfbe37cb0ab0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502071738433769-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b2f3b3e1b7bd208310620845fc1ae38f496bc75369f23d4fa4fc10482a0f8243
MD5 d76e81fd63cbe0da98d20eb4b90672b8
BLAKE2b-256 467e9c300be6398768ef0f4c78991bbe7eccee234c0c50d904e943d992e73bbb

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