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

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp312-cp312-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp311-cp311-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp311-cp311-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp310-cp310-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp310-cp310-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp39-cp39-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp39-cp39-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp38-cp38-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp38-cp38-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp38-cp38-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 7ee088e36c0cf58b09066d47d09560b7f6b6905c0d3a4538604c5cd47ade4959
MD5 e58f056f5a3f4bd6c9927cb67195e044
BLAKE2b-256 95966d647ede01d2f7a4b0ce76ad2b271e8744e4f31586b4a5d7b4413cece302

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d1f768087655c36a8728f73f911e1d953ef2d571d9bfe0998d89be30e0cfd0ea
MD5 489c9f8279efedaec3d1fdee9f41c8e4
BLAKE2b-256 eb7369d546980bb3ebf39d19efc522c7282f57178e4d9ff6c69fb2a1b21676a8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d40abf3e97cb07f10b209f0b0d45094643a41702f5cb0bf36c7dd3ebccb30261
MD5 3bfdeb93393446ebc6446000498aab02
BLAKE2b-256 682bf3068d703d24a44ae6f12e20821d8121019155b81caa184593cfb71ee4b2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 855751a975be77ff98fb8bd31c511ef15c2677a4c829e9894c1b4eecabf38bc4
MD5 1c5339c6186d5f8c9dc80c26451d8eef
BLAKE2b-256 e1412146569b1d1779a47a066bf2569fbfba7cfdd0b77bb5d9ae24d9c1f6743c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2cbe5aca89103b0f486302d28774a0f3997334b9030912ba20fd47c3608633e5
MD5 58a61416f75b7aed028646e4d355ffda
BLAKE2b-256 77cc1d686d5dc5deea067d875963e4da8714111bfd8a33e82cdb4710137494a8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 07ae2a0cb6a38b0eb001862b4f4892a269c3b24bbdc198c6e6e4cfafd03055b1
MD5 add65dce0fee19c78404d82b4d15a70e
BLAKE2b-256 33ca6996d4e6d1c18bb469405c6ab5900400ec04c277aa73b796a90fc313198c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 650a5b9a492e3679c22bbf8be088d2e9c73473e5ae57a511cc6a268e77df5e90
MD5 e066201b04048b69a0824f606940ba95
BLAKE2b-256 bb278996782c07fc3352145bb9ae17de41e0bbf9a90ce78091e48696a746c376

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 dfd7f2e5d175391d964ec2c775eeabda8aadeee5a3f0e846b33f24e5526eed1e
MD5 be4e1bba3759dbdb4b7102a49339e1e5
BLAKE2b-256 e2fa474e5c284ad66132ca2c53bea628fa6e028a8db1ec335a8ebefefcd0d239

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ce9b40cbf3a6b39e3a7eaa032de2768ba7d69cb7f7d6a85e5f59d025c2ccfac2
MD5 f0bedb2b8a3a02a8e2c686f830640c80
BLAKE2b-256 926484784506c65b9aba5d74210f7671b291a01a850331076117d50fb0bcb69d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1886670793f809b4cd4b4841ff5007a7e82f8df9f1033db0e3bda075f444e6e0
MD5 61ed0bd53f5fb0d2da9d00696a511951
BLAKE2b-256 45d0cf114b1289d62ed6621f98dce4c79999521e0f9f6381deb0b4b5cc435c8f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4e249e2c3d2b3cfd853538f7f47e68d3cee618e45b0e845617beea76b5b69245
MD5 6749821573a3403807082a6ee11495b2
BLAKE2b-256 a16f2262d7ecbad71afa3b023fbf2c730aedd68e15828d46546f1c5a07443a50

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 04a92b7e8e0368ee1ea32309750136a0da8b117874a9a37958d3a58d897fcdc2
MD5 78b74bf204e46716d87bfac55a24f917
BLAKE2b-256 0eb0f2e05bd2bd124c7ff8204edbd5cc10773076ccf4b4f3d19642d10b57d435

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ab1df50fa7d565d0259d1b27a184a257c97ad99d909c98ef45e0df3598817f40
MD5 c7f0af9f471ab29949f49d47cd7163b4
BLAKE2b-256 64b546ce59dc15eb48e2704acce41c86f11ea940222b3fd4190e8b00d6f9a433

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bf56775e95d04f01ceb4de9affade5e33186e60ca477a88b6f5d0b7606c72545
MD5 48ccecd36fef37af9715a4f3bb5cc14c
BLAKE2b-256 9fa3df8152da1e3ee72721c842b00046b5950d2649190b4a79ef6146f4c5c53b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e43ded0d2e2c910c3c0a71108c9080703094b8922f9aebbc137eefd805026fa1
MD5 3d752d277d733f517f9e3ebc011aa683
BLAKE2b-256 63b136b5d48ed3571d29df42627e93992118bd4b090942ff20a645faaad5a008

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 d922223f1c353fc5c2b6f01bd71fd73e5dc21bf56bcb6e74fef6164c1ef660c1
MD5 c0f102f68c11e08145482b502775381a
BLAKE2b-256 d1d7bd67f42a4dacf2c310abe44d05261536b96fdf67b225c0131b584f3d0fe9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fb1f7069b07a74e3c3f7d9ebabd388354f99a001967374f3230274a22eb1a9cb
MD5 a9504a9141f679a0520d176780d89a48
BLAKE2b-256 e1804f838b3853d7cf7ebd13c514ba83e3aedd8ea39cc87de76617a8245c00c2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9c34795c617752103f1b7e3cb3fdbdc6425c92c579c53ada71a956a2c573b626
MD5 3a325a3180ba9f168bb4eaf077e3a3d4
BLAKE2b-256 729f7df9972c747f8c5f1bdbf7e539e6c67ee5b0dd3450c412e400caeeadcff5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8285a5e95baa1d74de73b8e730d9fcd2e2789617a4c0ec4873a5100b1979f65a
MD5 5b41983d07fa857aa1f92c36dfa49819
BLAKE2b-256 2f0aa932d0f19f7ca595672366235c74b9efe2f469bb9327c7ddf9f51b7908f4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 59db6427e5ab9f9f8313a58f1ffb442fb420e31c39aa2654d1281bbadfb78ec7
MD5 9e22c6ec11d0e14fbcf006f120b872d4
BLAKE2b-256 2b9c4f7ec1d4dcd8c37888be0ce4bc22452241792ae3962ac9ec1aa58c63548c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 c372b938f4d60a0667dafa48d87d766f47493d852d900d20e66f30c98c80e255
MD5 38e44cc29458ffb6f23c4a7b2609e440
BLAKE2b-256 283e4de0485e74b26f81b5202be3a99fe3f9a65e649dbc2379d0a7ce10b560d1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5e7522ad75c523cd6dd615f973a745a69650ca766b41ed3dc6e132c68d3dd63d
MD5 db6d6f61958268191925e231cc555cb2
BLAKE2b-256 30b4fa24016c0161ab0e024b4d70640d8794156e4cf1f700283ca8a7b9741e8c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp38-cp38-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4ff7ddbf93d14cc67d91751d5991f26dec6f07ee8da53c99df31a907cd73b5ee
MD5 3cec77fcccf0bb8c3fac31d1592e5211
BLAKE2b-256 71026a232e511d610a934ed3be6c6669dd246ef8194f47f5c0b9b08e80f4773b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ba801471260b719ce150824813bf6320e22697f6c2ce716e104bc8a31ea27ee2
MD5 dadadbd16f8a7418bd2fc87bc3c55ab3
BLAKE2b-256 c363d5b24ec3d5727a67c9255b742ece58cc60d0ff49af54ea12fa5cba6f1339

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403211709747362-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4ed0fe518a4dfbe4436a7dffd2f3727edc3618528990b6c57b72690725fcb7fb
MD5 199a88891f4bfc5dcd633590a5740a8b
BLAKE2b-256 4ec55973e34ae2c8ed8d5eb13b8f1695e2516bfebc5e9d69d65cfbcf800798c1

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