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

pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp39-cp39-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 aae335a2de319337d8d7f54d609b167b2e318b5d5662e11be2ff988853c1f05b
MD5 849020830f6462f85e6998f9f84ac843
BLAKE2b-256 2ee98bcbc82779f6d20b80d717d0742b870c46bcc677155963c9046d644ce453

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 90fd84b44dd1adbe539759df023bd682583d1a8629072caf5d10bf86efe0608a
MD5 b4aacb8d872030780fa1d1a1e465c592
BLAKE2b-256 2c00b31dd2fb955144e6617d7010e9940b20a27908fc78fd1595b3393a3254c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 96a5b8f4b36557270c92a4f4c0f4164116ca474593702a21562d9f20e8c789de
MD5 46a0b7cd8cc97fe7a0cc86c7a92cb9f6
BLAKE2b-256 7812ec3138a165e13d322d79d2d2a6d5b89eb4b6f2668f5de5e5d78a81ebbfb5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0f23ab00e6eca2c1fe55d695e1f96a978f68e9a369045b41cab65144dfeca822
MD5 1474207b8548906bfc3750b5ce1a8358
BLAKE2b-256 f56860a749d6fa753dd41938a0479a1d9694a639169f033e0920986ab1362577

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4c95495923b0a5810b94723e8671611ecf092047ebe77af735d0fb0372854c00
MD5 5d3aa09119cae1c8e873b8e20dff5bf9
BLAKE2b-256 f067e6bee3c039469ab883e5ebdf1f9f441c8922a05893090d9318f48626e3b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8cc7c97a99444051402ac2824720cee0ccb042020ffe2a83ca9ada3830361cda
MD5 dfc333fe5ae7aed4a5e7eee70a3eda1b
BLAKE2b-256 69eaa3afe95efe5b3b436ef1b589ab7cd975efb283b67f0f03db0e5f4fd5f66c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 97fc1640e37e998b95884f4835e111d86f4582784e728838f4c99861d17541cb
MD5 5a8a6c11dc728990411bec25032181c3
BLAKE2b-256 7db3a44082870b454f1a0fa08d58f1b3e50eb16b32f2f0720b4cb162229f48e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8c3e004ad82df9b6174545755c4960ed44bdcd7046c11feee35b6d0c58ab6a6a
MD5 6e2d9c117f5bc19728f1f6fa5d799284
BLAKE2b-256 cafe7520b93b9843e4a934b396c18b1c8cd2568d1ada991812e63beea3474f7f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 49a97fb69ad6a784f943fd6cbfed3eec2bab7c2b4f1238650daf6e7f03929344
MD5 6f199b3b447c8244b6c88e60f0cff8ae
BLAKE2b-256 035f9f1042d2c55dbaf806167934f64804d774731b94ae8dd496041e4faa31ab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3dfa8f9094ed6205813af8781c1fb4b60764166ae62f7f3caa994b0a3b775103
MD5 8bacbee6aee5f20e0d61d04a73d6129a
BLAKE2b-256 f0a27bfe4500fc8142ec79537bf99c7fb9dbfe0542a1dc090f91f60275de8269

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7e6e4a3c323887c491284ad9002253fc274471ddb5fa1b9dd7ab2d2ffacfd192
MD5 2278d18c9feaeabcde91e79d8381284f
BLAKE2b-256 f931b3832abb66c07bb67df8b248ddb05414e1533ba55f0218e026aa90e97e77

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a9758f4225c88c2c4203337c2f7943e67b366ab4257103fa0e66b7647f2a7113
MD5 36d072dfefe0b737d38d892582fc28fe
BLAKE2b-256 17669b73984222685fb1ad7c83558db0c023343bd9ea03e95a924998535a4023

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b2e30013156ce7e37eaa9d976edaf741356e09e5228e9a554041cc8c9a5a963c
MD5 cb49ece99450fa7f7067137c771c3d63
BLAKE2b-256 4db115b2cb12e9cf2cdbe11c13eae4d719d3f4df7e78feba51c0f8f5c06b0ae6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 42685d9e2d86a9f2b8920f01318e05e259818d26a5ee1506419fe064535dc38f
MD5 72e0d9165cdf807c5360db6837b8b3e9
BLAKE2b-256 22c69eb962ab64f71de6dd31922ddf71eac2c1e156d9f5fded26da22c2812067

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5a452343ae4063488237ea6f417ccd6f21ba805cb2c84196c99bc35f27216a4a
MD5 e13f37778e389e28211d22661561c720
BLAKE2b-256 99e6c39db38009018f5eb6fea4dea8dbe8d0de9892420ff23c03a5f36ed29472

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 e46e56aeba03c3674bd5c148aad30c45c1f879e4eeb4600087836fd461ca5a44
MD5 08b340074a098f2665d9b2409f3e8cc4
BLAKE2b-256 a274121abaf2d58dea4b25c3505fb299c0223ac32724338c4dc7b686e9532bee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 591194c60f69426b9de61cbd5dd19763ba2777cd4a65914f85b4ebae8717505c
MD5 fa4856d90ec5bd8962a3c9129782f685
BLAKE2b-256 a216a90e6d820a9a7ea465a738ec78004a2dd6d84730209aef50fc08131d34b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 01019fe6a3670b731793cfe5810bf3475e8f34dc5657bae2dd550a0158bb1e64
MD5 308ae6dcfc822a1c496410e26465842f
BLAKE2b-256 6675c33f6ddb725d26b025672422a7144a4db058c591cfc379867c9610f50af3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 abc1f1d68e55228c9b56e7a3e2c849b285a8ced34fd7839385ee0c0ab64d0e47
MD5 4ea9531515b393501b5a284e74fbcfc4
BLAKE2b-256 db79656ea4a80ad7e5ddc8aa0fcebc053ce9798bc7413d8b294aefc8665dff38

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407101719384100-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f9bc24abf26800d8a3872a84d924c3982a86184c5b8967741a3e13f1e6da5642
MD5 116164942606532303d3be1e81b7c2d0
BLAKE2b-256 fe6f04eebd83c3c8eb11380afeae7275e4fb3405309095469a396ba655aad6ce

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