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

Uploaded CPython 3.12 Windows x86-64

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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.9 Windows x86-64

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

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403231709747362-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.dev202403231709747362-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.dev202403231709747362-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403231709747362-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3f643dfa970bb9fbbf42e71da43f1f90e2a57d309b1f729f5bc2f9bccba783c3
MD5 e1417d6a49e3076bfd6830d7031ec544
BLAKE2b-256 b7280e3b034f2729d8f5a835f5e9d227e15d50ca0ed06396a5e130490f56f014

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403231709747362-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d8510d39778bfd4da37305dd95bbb765dcced2ea9b53fcc0023ae64e251ddc43
MD5 4c79efbd4a94d922828ed9cab15f21de
BLAKE2b-256 b9b6c000ab50fb159b84d65629bd9625afcc6eff4153df60708c16ccc372486e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403231709747362-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 66aa8b95569a077d9cb87a5aa52c9cf6c5622ecce9e8dd7983402d181a6ca30f
MD5 32ac66fe14e31ceaf0bc69d5593d4ae5
BLAKE2b-256 0a54fe29afd203ccf3cf5b3c0d6af53a8116f4ef3ae7d9c3a7436d7546a253c8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403231709747362-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cdb247424712202f89aadd1c4276084437e4ccf020071ff9f2471586034697b4
MD5 aa34080c1daace7c9938d5d296a92e16
BLAKE2b-256 1a045f74fdd3864fcaad6a638692d14f299212956fb9ebcd319077f4320ef8f6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403231709747362-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a10b5292922fd6c03b16f8490d42ad04d6c38b8689510b40ba07fd824033f2be
MD5 3edbf7defbac19f1a2021611043354c2
BLAKE2b-256 b80ca86589cdd4b5ab1ffebb19d146c6bfce2ea035042f01bdeacd352d70471b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403231709747362-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 543c98a97b7eda0108ed3ee0308015db1d0d630674ada2544e50130a2170f763
MD5 7e7011f51ab8a9f6620264d08a6be65d
BLAKE2b-256 4d07e939164ec235e3b4d45a6a21dbc701ac6fc1d62c612e0d28bed77c517ad1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403231709747362-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1be7ef3ac8c378ee01df754899632d512cda42e20d1f457fb67faeb5715bcae7
MD5 c4e9b548a983008f1ea9afd367d059fc
BLAKE2b-256 4dbaa4346fbda4fb3a4a6c586df691af8439c4b0eb9d3bd8920833ef5a6b03c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403231709747362-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1bb90b863acb28bcffaa7aeb5b18965cb2e7072c525a1e39b8f24c8e06d43e0f
MD5 6bee107cb36b469ff93eeb321e74360d
BLAKE2b-256 a8ac75b22b6c3988aa378e3c072a333aa81a04211f7f0496d9be816b3b96cff7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403231709747362-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 44c96f6c0d22ccfb74ec3059c486ccc53019c58e1e3666782337692bcefc2800
MD5 a9b0a322516d0949a8cd0d21bde05df5
BLAKE2b-256 6901c70a3250b086bc25c86020fd3c1d7b47325a75d5f30956af04656d6f51b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403231709747362-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8dc7ed5f8eb7e62ae1a6ef3c0d4d12d55e9cfc04b5d197abff1f783e9432a632
MD5 3b167ecdff10426ac1069585e6153431
BLAKE2b-256 b0622c342250bc3dd81c307a5c880d0651693cc10e3dd694f9375cc7656374aa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403231709747362-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b116b6dd244bb4fc1937789ab6dddb9a34dad9eb6ea68117a6acc659d58a2100
MD5 31321301aa0fb82e39e0e9cfbb6c570b
BLAKE2b-256 80d6c85b2ba9692d6993ee35adaf421b890052defaf5ee8cf4ac6bfde45eb808

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403231709747362-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f463b3d1a718832dc3cfd0bf4df66b52f382d58f9ce0e8b85248dc302154fbf5
MD5 914042cb3437576c658f17d900c8e77d
BLAKE2b-256 5ef20fed793af67a17dfba3fc30a79ff29bd7d4eb21237654499b2ca47ed4715

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403231709747362-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bd808017c73934b65a177bc65c9ca688414b232d6c4ceed300e8ffa57a9e6560
MD5 51b93ca42cc3492e87f19911dcd9e35c
BLAKE2b-256 f865fbc84a7c8d80f8bf8a49de26a785ea27b5c69d4bb98dfb4e5658c7df1a66

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403231709747362-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a2976e6b97e06c6f85d6d81e2e820defcef8d0916a275640894f33aaeeae9a21
MD5 28755824eeb4006dbdb0e7798700382f
BLAKE2b-256 69edb6e9dc0396c2a0c794da4aa27a7707180add07d9074fdf2a471dce89bb3b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403231709747362-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 35a3b22317db1bc5a4eba8f98d1ce14bca7263a348a4b1f0a1700bf23ac1baca
MD5 9cc2580d162fe088cf908797d2bfaa9d
BLAKE2b-256 b811547f823400396fc19ec05be5111fafd5612d4fb1cf56477e8a0b56ec465d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403231709747362-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 3ce1bf25a1ae71b4e98877005b9fdd196ad6042d0b76cf392cb6f8c5135806cf
MD5 a0777091a8fbe28b562bc17cb65621fa
BLAKE2b-256 1343c18a19fa21bd991c4aebaf96c7a98a336270459acb06d8c67e97ac7a66e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403231709747362-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0022869a55d31f7b7f3d71733f167972741bde62b8ca32d76dfcae025e5371d4
MD5 8176d3bcc1a5f64f4bab4ba3ba127654
BLAKE2b-256 c4c0709e80d67f00b9d21ea89e400893f94fc140d9c8dab5bde39aa65802e54e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403231709747362-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4d76733ca856731b55d863df479095f58f794c92fd79f709f16e31a72b76b6b6
MD5 79e2b63617385545316c16a0d2923aca
BLAKE2b-256 7e3fdb45828a54439f43204f8c879ea03533bba4845aa47ee389356ae08f12b8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403231709747362-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 eb972ba3113b963665127cdef7bdcfc8054a98ac3cbcb1d29054ff146da9fdc0
MD5 be5681bd03446b179fd044c84d9805c9
BLAKE2b-256 009960457395e273cc1b9b01fd03bc52046d1d5559b895629ff754b87065cc36

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403231709747362-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e4cf90b041720d1faee736b8f2f419e719ba0635b0838afc4b29c59033e0bcf1
MD5 f3fa9b463db6b2803b05a87f93bdd79f
BLAKE2b-256 5a43c84f6ce42471cf4eb0cd84dceb29a27c01aaf31a02e5b2f13bc286d739f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403231709747362-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 cb8fa0211cccf539cec437536c2266db78e0b97f8e9f5a34051675f1ced9c6d4
MD5 faa95c42a0c831fb813382a6cf273314
BLAKE2b-256 20d266465880f2e75a175584f76eddcf0e09f8b46a34798da7edfb9475ac7255

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403231709747362-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 43bd7b78bb93030766bcdb464757710e96ea11e2c16e052f46c0c845add3f420
MD5 4555de37fb056b4ef113af5eb09c8c63
BLAKE2b-256 44d8aeb9d0a1155399d07ccff3eaa17520b13901c31151ddb7005f1a6728bad1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403231709747362-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0ceb2ea0cbf3fcfa9d68588376e1afff4335048c6142d53511a2ee765d334a45
MD5 082364d77dc5ec6c1328a5f4fff3a002
BLAKE2b-256 9008e07099b7f77c363ff8db28eb9bbb7a59ceaada376bb0ba45ae5d43e9a84b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403231709747362-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 55a8457e64d32c5c580af0e78eb0850852afe7146d86dc00b8ebdea63944c0e5
MD5 8b0ece809ffe4805fd605b0f4927a6d7
BLAKE2b-256 62d4961727bd4d20dac8578e1432e51916c419ddaaa6648c9c08208b50fcd479

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403231709747362-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bf6a187d6f49a28d26669822a7f86f3514a70d9c672154a334f7775a918e8f4b
MD5 1f87da672c9fbd26b7121f9284bf38ef
BLAKE2b-256 405510882a5c030b90f22d3026574534c7f48d45d26d795febc10505e11969a7

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