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,2023 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

pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp312-cp312-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp312-cp312-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp312-cp312-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp311-cp311-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp311-cp311-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp311-cp311-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp310-cp310-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp310-cp310-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp310-cp310-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp39-cp39-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp39-cp39-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp39-cp39-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp38-cp38-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp38-cp38-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp38-cp38-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 fc99619f65916544366b6dc67a25add3451f68acc01fd8f3bf0bc26fdb88ac1d
MD5 4e14bd3c7b078491961f2b3dd069fa06
BLAKE2b-256 8245c04a5983183088ba5acdbc049d134315ac47a9a116a7b5b228685cce005b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f9b1eb0a1d1d6220edcacb636d760167f444e6d8e366d36681f6786272e75771
MD5 8860375dec22a6baff87c5dbf107a8f7
BLAKE2b-256 8d10f1383204921edcef3c86b24aed9cb8ca20d4192100ff7abe352f5f36f069

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 36980d378e9282df0018775c6893e67d0fbe261e1f812429a4d8c4439486eaa3
MD5 2a37fc64b779138cbfa7b3e154d2d928
BLAKE2b-256 9af94f381ff59d4fd4ed072366d03721753fb5b493771656647b3546dba2c9e0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1cd8e9b074df038733e370d54e6f098f6762121b7d712b8fcf6e44ac5d88aed5
MD5 b00f06c5e1252e5b583663845bf1def0
BLAKE2b-256 fc545b827f778aa238b68c84ebd658e06ad02bb6ea83f9d4286485dd1adfce62

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6635afc104df33f05d2b067fd89ba3176b2a2fbc312d2096f1d64865247a3694
MD5 296b0eb796db450f5bd082981fd47775
BLAKE2b-256 bafcfa3070911cb13228c47e03a657d60dd2f618e0137e280882fcc8aded0f2b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 6fa315c498c63208a143ae2a893018c93cb184e3c8d5596078a79db3954003e2
MD5 3f7116cdd1f67be530abd66f6d08325f
BLAKE2b-256 d5a5745f0c283f5e2e3d2697c6180785ad181ba06b41ad4833d71e7c9415453c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e76c9f3a0054392d889b7e94e69ebd9077c69135cdd474d42bb1e687fd24e873
MD5 c0efd70c4b9475ebc1acbb4b4fc57088
BLAKE2b-256 4782f985c89fa6fec88403449e51642bbf0d664db96248668ee89b02a203fac8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 14b3df0eaaade9754d94e1461be50db6e8166e8e02be4b40a97a4009a9ed2fde
MD5 7730c80d952b967122467b1f3ee1191f
BLAKE2b-256 0e9d061527404a0d9c7e11e6fe735abb6163bcc26799b35d03e531248a9cf1fb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d04b0d5efc745cbf3107af3ca04cf92d5422c9e38ac98c78d19654e287441356
MD5 6e54e9773371e0ada43b805e2b466ef0
BLAKE2b-256 428b763d11368a8b39d5a78b82a61543a3a23d3fda1aea757fe4918637086cdf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 146cd85e4b271a2719996336cb7218c7dceccda6003a8a45fbfab620ed33ea34
MD5 8506598e2c29aaf7c5008fdf48ea9a6d
BLAKE2b-256 1080c2e597bbdd775af52fa471c0aaece6e463e65c14c228727db7d6fe1137c3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b1ffa1a893afea0eec976a78df76ee42b147e645ec6f5a306bd54833e3426066
MD5 868af21122d3a7fae7b72ae18c824833
BLAKE2b-256 41978a38d1ca0f80d5cf1bc4fc8702a9792da84bbf15d6d8386d48cc976ee202

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 15756ae9e5307138c15844c03b250f0734837a785c2da1601d09f46765d8c69d
MD5 ae0f20eae973b1016d4ab5e642181f21
BLAKE2b-256 e8d18826eef0de045c7759ecf4dd4a5a72a81490f21a67e9b49a4efbb973aee2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 85e3f2c60e3e89ad4b6e470d8e52f4ecf67e351f06de60aa0a3c2e87e3658af8
MD5 65d4229bb7bf1d53ecfa9a2a48135d20
BLAKE2b-256 c9c12a203c88c5e0443b8b1d0646bc06f438130c1c40f538c36051bfbbf94c8b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 00e846505402695c9c5490b6f99496e4304d3f24afea4153d1c271b9efd89229
MD5 8e9a64464fd3c89999fbc985e173ad36
BLAKE2b-256 f21e42dd8a948d7798ad59859f8abda47697f12eb895382646288256d13302f2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5fe1a69a5e0b7cc0bb811bbdf60da5770f950392b455392d6dd91918c59f8b39
MD5 d315e01f2462d990d291c467b8c8b406
BLAKE2b-256 9741f96cbe4d45837c8a1ea339ca6c812ec404c1b69d172ac73057ab65b310c3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 12a8db363d5d9bc4637ab57d3cd3d50d4952cd136cf5074465b3e7ac50a9bf99
MD5 f051cb47be5982efa089c532044d8891
BLAKE2b-256 bcbb082a458e56892bf43fa14cb3239a7ffdfa36c7e95672f5bd22c516bf13c8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1add2c89016bae1be54a6a13cf96e8f79f172a3641a2c0fa71109fdcdfb500c9
MD5 9643e7a765a060706180741003151389
BLAKE2b-256 ff6f3ef0e1a732e8574a79d380aa557da008b1df05061090fd4accd95f561b3c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c5c7b8fdf48b66d9970ba5d7b192cd3cce69df9e0347694438388292ca9fcff7
MD5 1a19a3e353b855f1b3e5974ec94dac9d
BLAKE2b-256 d3e84ca3c94ec3dd73f54e92e655a853a39637527e063014775b24f2a4ca3bbe

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 622cfd52360ca3e948ea7f3d4f5a0034df411b99aa95ff875bc4a51b58e4c9ab
MD5 497101412324e88ee1a8c81c0ec796c8
BLAKE2b-256 2b63b249b1b52770262f25d304e2f52db9a0499e28567a78049b0556c18c7eb2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4aa321d3aeab48b37672884e2371d599291ae5636dec794397cb7d5adcf9f78a
MD5 c47a33e6ae0b531e8b9febb77b8e925d
BLAKE2b-256 091fac768897b9c704627a4de739eb6d9affd23b5df389aa7aa0750cd0c30381

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 53bfb57659c38edc0573bb29e96cea9a4c242d508dd2df0b876d46d10f88257d
MD5 2d87a52c0e70e4d098b7b45e34513a76
BLAKE2b-256 754b37d4f7c512a47c38a3b13ae724f3f1b7c78d437598b1e8a5b4ce01dde789

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 defe17fd4ffc6fb11bab06170d62455982c4e89652bca65d60e3cbfec2e5e0d8
MD5 8092d3989f5017c4fed8344baf00af30
BLAKE2b-256 0156b7e3d964d04839229806fccfed3a5588ee931928c497b2417be9599ca8a7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp38-cp38-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 684bb8895b2b36216b9a0df8a35c42406ef2927553d223fa6f316f97e6e1b352
MD5 d846d814630c1be3ed7d80d7f2850073
BLAKE2b-256 1982930a64a23dba2e1cd306e42fd23eb477f60d3f745e27d54f218afd7a14f1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 924dc5b28329053dc1f3183bb19bf737d6a2f7eaece593a3059c47134dbef521
MD5 da1cfaf240d947661e70a98cf7ab94ee
BLAKE2b-256 cf298efb7e9346c6667cf2cdf9c4961af1922a37b3da53ed16a8693501fd2fa1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401161705041676-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7c4638daa73656efe5bbe7c36f7f8653b9ef0235c5286123267c0bc8d0622c3f
MD5 5bfaf64dc441b9d50f38a43bb01518eb
BLAKE2b-256 afdb84a37b641ffb2c549c49e9db21798132f8e494119effb0ad5838b732c66d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page