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

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202401101704620238-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.dev202401101704620238-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.dev202401101704620238-cp311-cp311-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202401101704620238-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.dev202401101704620238-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.dev202401101704620238-cp310-cp310-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202401101704620238-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.dev202401101704620238-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.dev202401101704620238-cp39-cp39-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202401101704620238-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.dev202401101704620238-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.dev202401101704620238-cp38-cp38-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202401101704620238-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.dev202401101704620238-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.dev202401101704620238-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401101704620238-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 c44bff0f26c5b7a34b9400018bad3f4f82aed9336c186e447ce5a9b4dcec2922
MD5 a9923eff4f2d246f843762646700942f
BLAKE2b-256 0c14a0ec9cd19b94eaf21fe3ef21c8dad2515db62b4857421a37034ce9d4d965

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401101704620238-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f2211dc1f8cd466ec049ebe5a1df67b8edcc4f52c6516720f59ae491a2325e4b
MD5 f12018ff37b328a21487a7a7c4445488
BLAKE2b-256 54c013aba35d422575d9fbdefdf821e90bfcfa6391ffcdc5792273220e0936d7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401101704620238-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9e2273d33ba45742ba1c882ed2b3bfa8865f72a778e0c3718907158a8cde63c1
MD5 74bb5959d6643628a38042948db4f392
BLAKE2b-256 d49d1eb56557ea67137a289d3e21690c4ee509b95dd4abe83990749698261aa3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401101704620238-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8dffc5fc51615852a3fa7526ffb3bb2d1ef0fae4f451eb2d3fc3d6ee80d45095
MD5 e889ca087e48f39e2b4ece72177c16df
BLAKE2b-256 23c043631ede7ba9ada3345f2553b4a2642aa2baf68c32638a47fe6225f903db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401101704620238-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e6f8421fcf56599dfb666edd7989ec9e60357c3e29ec3e0c3585c90f13f60065
MD5 794e2b000e654a6467d6aba4270325ef
BLAKE2b-256 9b43e978bd7d4489e630ab169c3d9e0c625730e49d40946321f66c005e5e2e4a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401101704620238-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 3c65f2f1ec412f3aa62b672b4c49e43293371a1982b92f886c788ffee84f8baa
MD5 462156c2b84ce1426cfc7ce7de249ef8
BLAKE2b-256 3642cbd955f4b55a095541e7deaf44bdf2b8bbbb15b6e21af56f8eaf9a43cc92

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401101704620238-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5168b4e9c9a737d4c7e0f0b1b3a6d48cc3da4e2839a0e26d34815e4069de7718
MD5 945fc819943851101300d1ce6ff9ddf0
BLAKE2b-256 df27fdb9007b3a2909033809e2b102d4705c9267ca9c10f79806b6d2a4b8e429

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401101704620238-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6c55b3d2bf915f066bf29d235223deee380827c42a7e71a6fa145efb56d17852
MD5 367edcc6fbeb47f1c0694100a05ecd17
BLAKE2b-256 42b68732013d3ec47354f426e92c1492c49142c70fe52437e3d833ead3b4735c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401101704620238-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e5ccc6f4c300a7706e6eb95cbed9fcb5203825f415faa300cd7514c2e32a34e0
MD5 8e75ff320b33711dfc58d497a55e62f0
BLAKE2b-256 fe695fe8c17c5ac1f0645edd4766d3f2dbe762debbff2daf1e9a95e3bbd3b22b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401101704620238-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2dfddd24e1182fd3bdb9c109911539dd96fef9f61da6a6439cee15485f3166ed
MD5 fdb36045d5eda99af0d425357417833c
BLAKE2b-256 09e355d5fd8b022f42c4d8783803a11b7f7c63d66761c65933632f8f60117df3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401101704620238-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c841fb4075988c0521eb5f10519f947bf2ceabaff30ff1e24e146a2b9dd5e822
MD5 e6c27d210025d4f3d134bbcf42e0152a
BLAKE2b-256 391aba59f82b8ccb6e936c855002db21bb7a6b9dfb6c308072c450b149456dcf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401101704620238-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8111eaa6d504133ba231fd2a24c158c0f8dfc22c74e229e9fca01ebab6fe5a4a
MD5 c1c0a7b78a35a6831bd955e49b2ab7ad
BLAKE2b-256 f72c3fb32d0bbd954b963a159f615ee5f498a6432aafc3e417bbfd101d8f523e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401101704620238-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6bf0b0f4a62f362b80a7f24498ca7c29e1535a6db4493a42a89565c985979939
MD5 b702870210034818b2e6db2808562761
BLAKE2b-256 11b105cb9e7efe9bf9118d69c59fa93ba2d59b48461d37e7681d90683dbbd0fe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401101704620238-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c785365e471cb52dba113ecfda31348bfe47492314bea2fb6413b190c0e870ad
MD5 3306315f5efd93660962343bf9fe1ce3
BLAKE2b-256 e8efae442ea4b19161559141be87e6670e89388f50c41da3e8022965864d5011

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401101704620238-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 028ff8f446d54d69ea443557c95551bd8ac29389684eff3519cb79a6d423bb96
MD5 4c35731fc55049444fc65b1b0ce9aba6
BLAKE2b-256 4ad632ca339a32271b5c95d50e6602a94fb7b7836cb0e04ab86146d10e4984bd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401101704620238-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 1e07fd5efe760b490100be69df63d69c9162df798c8ab4882360b90eaf09156c
MD5 18a7d8de9383ea7be7c179231e9f127b
BLAKE2b-256 a6ec59fbff8d61278924b47a5ed999d116afe7461e21bf9c029d9ae3bb1fa149

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401101704620238-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5651c7a862a396d47f47809c46e0a8dfad37cb79d02065647bb1558a240fa9dd
MD5 9d0a373ee65dc470da164a3377f82836
BLAKE2b-256 c23425afe6c494539d6652024054dc94265899c9571a7f863f6341ad63c88ce8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401101704620238-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4f817f62cfdbc37d59a032ddb5f5f3f91e4639a076c4226c11841e71afda7e03
MD5 45439176169c93ac634e23a8fc470bfc
BLAKE2b-256 e79da47eb629f759422ba44ed98b197e0f39cf06180ce1bfb1dff4b63376e4a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401101704620238-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6a6120ab2dfaf991c622fce1e7792821cf726af43478f764b72f8ca119df6341
MD5 b362312913c7516065a84e149362a0ad
BLAKE2b-256 5d82d40f1f5f4ae46c966fa39c0c1232f286639b2dbff89c4347979acde08dff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401101704620238-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9917e932c7483749c369b07bd11e5a4aefd90c9dab03caf21e55294f84851762
MD5 e89a1f70d192c9f6a6a9daa36aea9124
BLAKE2b-256 11c8f75e476008a576346fcbcfc962d0ce7e707d3960e7eb696bd9e8536cd41f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401101704620238-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 77716277fcf921b05e281b22d5a48837745cb2cea84883f338f8bc0612ffa3c1
MD5 a90e9e679df376869ea980a76eed8ea2
BLAKE2b-256 63da2c0d13b5f720837afab313af334463c7c61178c885d08a8d132d3c51f3a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401101704620238-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e6e33c4060d153f041c58124ae2b3f173f56ccc3fbde6cff3a4570eee9b73841
MD5 bd5fab953a575e2bc4876d95834134d1
BLAKE2b-256 89f17be57d38e84c90ec95959aac1ea81375ac16bd016397a44dd7c5050f749d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401101704620238-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 364130e6b8ecae05c841309ab46ef8ac6760f1a3371b1e8e47a2d12942f8fedb
MD5 cb85f3e969f02c45655a4944ad16f7d7
BLAKE2b-256 b3e27de3bb72bbeff97158ae08c6eef0411d38041016a3a02262830c575d088e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401101704620238-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6675eb8cab472edf9e2f9d833be8d89ac9677a638443c0b1fd5d42ad58b8696a
MD5 1b34502de1db8a0a5d38a62ae263770f
BLAKE2b-256 8c8db1368f63c106e5e155c4dd3ba0064591e7ff37f0d64140ac1e85104ae114

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401101704620238-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 66b82c355271bd069fb03f6483b2427d7db625344085ea6d9dfef332c3561f0c
MD5 f784a637a45c3af2cba773a9bdd767e7
BLAKE2b-256 1247545ec2c7c1fb6c87f94e8cdd5b5c85609d4686b0acd7addecd0dee125726

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