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.13.2.9.dev202406051715182293-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202406051715182293-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.13.2.9.dev202406051715182293-cp38-cp38-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202406051715182293-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.13.2.9.dev202406051715182293-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a4386ba07f20e6a956b829b196c4cf49fa8d3450ead3d680a1c437458cce47f7
MD5 620086f570dd06ad75415495db40e8a5
BLAKE2b-256 071f16e88ea604aa83ef76b88f33ba9d8559dc72a7401a6c50a45e4da0726ee9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2065c573d67d1045fbf9eed0ed833d8d7cf95c268590d42e66d67b092fc7fa00
MD5 f400defc19fdd01c641c8bea4988c606
BLAKE2b-256 014f25411d7e3cf87bdc8462fba4dc9613ea41794e0f99b14a3be4f11f9497d9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b1eaeca8f7a7e43a3cb54f7d1d3a44c760a55a0bc50f874cecddb7003ab01b14
MD5 80bc7082ebc9ef2c283ea9a1b451e562
BLAKE2b-256 a64f4cc2812f2e6902f8736077cf0318b0e819332eb6302f58e7c5ec3641efe1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 85b22739e044cac1f7772d8b891f7373057e5aceb63d6a0ce2791c6956f23b14
MD5 7ef4f0128185875ac84bbc0227072c3d
BLAKE2b-256 706e3caf427a3e5aa61842b34b46845bf8a0731f1ff24b525b387ea4c95d4be7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 631a55c98e3986ec7f5c4019544a64b95bb3cd0777ef52b53fd61ab870661b12
MD5 298533dc08f0bae53a1fbdc14f055f0b
BLAKE2b-256 5f5f68f5d7358c77395daf91e83b73e3f70a6345f41e9f7e7eae866e6bc2ea0a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 84bbb64b5edd85bfa72bc158d865223cdd816873e2b421bcf8cf1dc4a1e2fbba
MD5 9c87536bd8928bf7b839068fde485367
BLAKE2b-256 30c2d271ec9376c7782135a941c3cbb57826818fe2b209121aa88f33eb43eaf3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 92d9e2746b1f17d2aa811a600fae51525f04c4c9690202a070fea46514688a14
MD5 de5db732a8b980bc1b4a983c8c04c8b9
BLAKE2b-256 fea0a812f57f09f3516fd71ca5b15412dad33a04b9178db47c4de7187abb905d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ae6fc63310e8130bd7435a5573f83318785c7da2fe2bbd09535e2459e0991c61
MD5 58cad5ce9d977055fcad3fe7678c697e
BLAKE2b-256 861320ce698be4220d948c76cab3236589391cd3ab11688d79db95b05d8337ce

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1f9bfc2c326631da0e6fefe2514df8641eaf1ee51b98f3b32eab84dfd7b636ed
MD5 af0e690bf054e87bcc2ceace4dd08814
BLAKE2b-256 43a4e32b98e8ef6c410aa428cad7287f0b18f33d2daa545e4e5389d6da43f19e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9680e2c388d9d505d0ccb8bcc5a26c07099c0e0c3fd045e8fa851baee28d9709
MD5 133faf7ec38c747312ecc42f7778e5b4
BLAKE2b-256 63dc5444a71100ebb572d426c56f1bc18857fa01c6df5c68e231ed1fcf94cc30

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4ffd2507729dcaba559f8a29da2ddb2b0d9813db3aba4cbcbe7b5e69ef594f58
MD5 dfc1d8e5bbaaac1183f180dade07c152
BLAKE2b-256 dc0fb4580e3b7bdd7d7389f47e325b1920a7cc8b3b4ee63d985316a5314adc6c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bff69fb507112452cd4e9f9eba86632586877c685a6599e6dbe633ff06ea8669
MD5 b29c9ed800e81e1cb9e3118fb32ab934
BLAKE2b-256 ae4af79f7a541443c1d894b6f93950fca55d81cd8d47e704cc3b569a7e726379

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d49ee3109e6f157c72c2bf667968f10f011de150f18d924c31a75e9a6167b221
MD5 a3adf39d347392941438e9d7836b8e62
BLAKE2b-256 804123dc1fe24d673ffa6d824b74f77d006d53a30901b2c61605f88cca4b34ef

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a84f81d66252c815d95b63b1873760c98f6d26516de24c610a641007a2113efc
MD5 8820ce91ca50bf7336531f0a2a41f932
BLAKE2b-256 f48814a33a957bf1f1bac7315f4e233e6b0ec3157673d67a074d9fda12986f97

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c54f2d20e14a4ae365502e4e076420105ccfffb78eece2a50594ea37a1f1ff8d
MD5 207cd72eba454c29f13bf7e8e31903f4
BLAKE2b-256 a0b1effcf73640c222da6be040c617fa0cd3b90ab7c7e993ef10cd362e46dc95

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 1de164f3c80ab5686d88ef664f1f0f32c46e2c3b57d2668f71633375f26274e9
MD5 e0cf399db92ea2487e4620b834bb7f4f
BLAKE2b-256 b9a9450d606fb443577d02a3684a06f70bda5f0aa1e179dae0dc88e78c72247c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c184aa12aeb291eb3ffd70661e53f8e3e2b48e217fb3eb19a6b78b7971695403
MD5 86554215dbeecc412cd59020b0a46e85
BLAKE2b-256 db4d437ea5cedc78554cd11871b4a0e8cc2f31fb3424ee5af00349387246f65a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 418cd8df2e7832108cc2ea39fcbe6a51be0cbd4b2ee9c4acd378cc3f364b205c
MD5 93b93876c568411c74314aa02713a1ab
BLAKE2b-256 374e6469a95e3e276831a672fef84291517a0d67f9dd5d81970bf01188f31ee1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 685475add53cb6d1b770ccba9863cb4ef5b33436599351f3a5b971f3aa607979
MD5 b07fcc522256e7c8825fb831c93b5fd3
BLAKE2b-256 88cde43ba651b85219dfa91e17e56823690f93a94a6f8428bf49ed4cde8bf536

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 89ace45bc2578cfe8c404211380c15cfdbb25cb3f6d0af052202733974a0ba98
MD5 6f44a46fe8c8da57883f243a2e02cad5
BLAKE2b-256 78068aa06d23d1b4780ab729323467b3f924f8ba68ac73f4596696863329048e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 d5c507238feb9d88d4718ddc3c39265739346d54cd9b5fe3ad0e634c61c7c0e2
MD5 b8a682d58ea9d9f9673a84f5b3eaf2c9
BLAKE2b-256 a27dab051da75c9e384df714317fd73a6e1acdbdad14e48d9ea6a1df71a3b266

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 648b52aaca03811d5e6ff16226c9f57defec0e2552801a9176a52c9b402a5709
MD5 249c5047dac77b71c0f5ecd9fd18d911
BLAKE2b-256 8e513708b565fab9f5788d90be97af6959005bb9d5579801503f0c0fe3f03936

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp38-cp38-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 70adb4cf00e8851a844a7c2a24c228717329fd4733e131188739f2edb130b740
MD5 279e3086ab0575d2125fcfc1f3d74a69
BLAKE2b-256 27ad1970d6d95dc32a9a40892a0a82b93680e62196568769a77eb00bd719c53c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3546fd954bc3c92935d10ee86779ab8dc34b05ec302d079ef272268649167cc6
MD5 48866c050384e56e66713b74b8457cf1
BLAKE2b-256 163c16fd2454f94e625b95750219ac12a9c3f7222ac2871660f57445e6aebfd6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406051715182293-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5ad6b5fcb0ee2598efae96cb7c78b884779f4e444f2e47871bbd5bcebebc869f
MD5 b6d26503e1e96e363a94c604f1676b37
BLAKE2b-256 eba8ff5ffa6a0d7bb44198323a877f6243bce58ff8147d522f18714936f09294

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