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

If you're not sure about the file name format, learn more about wheel file names.

pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp313-cp313-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp313-cp313-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp313-cp313-macosx_10_13_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp312-cp312-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp312-cp312-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp311-cp311-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp311-cp311-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp310-cp310-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp310-cp310-macosx_10_13_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.10macOS 10.13+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 a2a4c876f35f5884854ccd22d29adb7866b9d9b16be579d2af5753cf787e55db
MD5 3f368ec50a3d889024106c502841a4ea
BLAKE2b-256 baac270f6d9c041390977e46e587d860f5713f7094b3f1346d0787f1851015b8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 18ee1f3544d37967097e111c6735f29c559fdebc815e571e2113ab8bb2dec06c
MD5 c25626c7f995ccf49269ba0b4490fada
BLAKE2b-256 6e94c9f709a58dce400fe0861b3e4f21baf7f3df59f0d54d25ff6bea8d88ce36

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 53ac4704f12ad637124ab51fc87a6c20d40f48e4db2cc14bbc0e08509ee97bc9
MD5 c283de63ea5899913de6a4f6424a490f
BLAKE2b-256 18a76b2536604d70b1d1392d990e75a64c2a1e4a70fbdc764332c7f5c9cf5d24

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7a68d93ac080e0c1fe0450c4a1b3031bf920a49c977eec464dd156ee72558ccc
MD5 21d6749a012aab237176b34c6d7a9960
BLAKE2b-256 8e3bfcfa12f211c65686e91d688e87dafb31aaf39a5ae89cc1343f2b05e9e10c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 b62fceec0b29d6752c042b9630cebae85981146119abff95848b68759c254b57
MD5 9da97c153207e7ef4f2a2ed014331eee
BLAKE2b-256 1bcb6446e8ae174cdae719275266ece985b6332f7d50ac7cce25e1ae498d477f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d58d56d0f9d502424c133584c9b30e7a907b7d9e95981dd30769965ba878778f
MD5 b41726c9197309f93b5f945a8a9f532d
BLAKE2b-256 01606f62cef0dac9b56b257063dff4fcfc11ad7046b9e88b79d7d3d9fea9877c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5f705adc68f65b6b20cba11e89514fdea46015a40362e5a86ecd9fffa74c1cf4
MD5 81a7a48f8e37f77730ba54231a184254
BLAKE2b-256 0d4d10fc2e06aeffc9e048f5aa8702c98141e8bc0a3e262fb8ce47e14d7259af

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4c608b81154bdc6d1b58901ff3a148bf083269446f1c97417d1abd634484222f
MD5 5540add9946fcc77c55591aa8f6e4fca
BLAKE2b-256 902deff8fd2c3bf04cdfb5e1931c701e075bd83e33a2502a79ae5e1de861b025

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 83038d158824a7ea1a634adebe7dca5b342a0965ef7ea43bc9b2880d03356511
MD5 9a1ce00dad17acbb1c1bdd5e276640cb
BLAKE2b-256 41ec6cef9839b29c8c4c69e910574dbf702448bf26871f0d4b7a366ef5634b51

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5603ad07acd20de270fc4596c249377b6d6e046edd39cc643edf67ffdd71dd97
MD5 929c7949c8c6381c95cc0401e1edb42d
BLAKE2b-256 f36d47bdd7a1bc06864f83ba525b320da798ed6df7992d41b56a57295ee8b876

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d87b10d5c70fe9f2536715d12b5495bda46bbc570890c62910216f6827cf27b3
MD5 757b03d64d25b40e4b426f644a65ac6a
BLAKE2b-256 a212a6f0e43df696f0279604eab5f01b6f70bd9ba4b760ae92b9358f614d16cf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dd3d0619dfd455230745600741df7708f799f6a2c528b94d10bd60be30aad147
MD5 8040a3baa98a29fcd19c4ed60f508abb
BLAKE2b-256 083f330f57c761c8e11e03db2bb43b55920cad8d55cafde2a5dddae87e123bcc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 31c60ba664bc5ac2423ea360043efcd270c1f8c0725a60d5071c95678da81375
MD5 3d80e63df8f2f94cbf52854358ebeed6
BLAKE2b-256 40bd9d4a88595d2b2c9268fb63db55421f2b65f778a9f7217d2f5d789f4ae6ea

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fe6c31aef08cacf38973a166d9a10498c2f1449fe1bba98a627c047d6f5f5315
MD5 37d5058846b003120b0d58e21b9e3572
BLAKE2b-256 b6f3c226055e63290ecb4d53919929f3411fd488c0e7ad6d1a8fcd03677c5843

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f12c2315a22dcf4dff9089d5736702a51cb71a95ef7f8697afbfd9b511460913
MD5 9935708de2e3116c9045aa7b04dd544d
BLAKE2b-256 f8f4b9c823bfe88e9dcfcf528923ca4e50d702cd285b13ff1f5f22396ad3c668

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 df6c2816845e2d1b3df3778b7fbf4ae8d9afca5d7834af17cd7d9eb64baa08cf
MD5 ac694dbd4fbc119669ed19cb9907dc63
BLAKE2b-256 816ee819d45323c80bb8813d0f538d1028f565f41ca52c56167848f4c02e8e22

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0e30b9a984c7013dc88537dd00edbfecc27c1702066f9b395ceca1743ff5f0e9
MD5 a8323acdb94344bc4f379807e77195d8
BLAKE2b-256 c3568622dff5f4c90f5dbf02780c6da2a233aeecee466f35d517492a70e67133

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2488debcb28afb9f6d808ad84a4ba708b7a0cee42fd740388fa217f157951364
MD5 c5a81514a73f8cf2ef0f643a441b564a
BLAKE2b-256 baa2c848be2c734bece64144b779b14b6baf4fd468b8cd7aa2fa2f03c8fc473f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 731fac4909bba38ac4e2834799caf1bd3d904a26b69cf4eb8939a04e55bccd9d
MD5 2cb5d537afbbedaa34205b8271e7ad43
BLAKE2b-256 ce52c9ff7145513640948c51317821c13a0ccb70e636edb48c551a3206f03489

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp310-cp310-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502221739452835-cp310-cp310-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 d6d85187b1228e4a6a749fe4d1db066124cf2f799e361f37b87bdbdf8ece9b6b
MD5 9b9a53304a7d1047ebc17d5c467bbf68
BLAKE2b-256 ee05db48a13ac4cefe63f3d6c6cbbc4f259b3f3789e7efabcd8bface43990864

See more details on using hashes here.

Supported by

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