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

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

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

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

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

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

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

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

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

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp38-cp38-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 dff439ddbc1e634f9942d7f5ef73ba50f2289e69270680b4b109ce35ebcffbf6
MD5 45879b864dda25abb8d6e05bef84f5c9
BLAKE2b-256 676b7e5752b16a8fe3dc845c3529cc3d231f61c1e7045882cc674cac47b08112

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1b3d16eb548c91005fdf36d93dfb562dd5be2d712fc20c98e445205d21f3198f
MD5 24100e3de89f79124d8432fe9955d1dc
BLAKE2b-256 38efc8bfcff56faee03b2e8a3dc85bff8b4ce19aef8c114aedd5322e16d7c0dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 64c5730163834c4fbb5d43eb0cc09cecd400b31c3a12abac042b0045a256f607
MD5 4589795d33fa25c42a5c3fe2c59a1192
BLAKE2b-256 4502a44aa679c5ff37d5d1b7b514e499caddfd2e394817577985caca918fcc63

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a76307c98b4a3632d32319213645b0e759d09b1d3c58e7e5716bdf3dbf160d38
MD5 68de342e9213f277fd3ef7f658f2f723
BLAKE2b-256 1a67dc64b951582e5b842f0909cbaeeeb5245a3cee6921dd122950f59db783e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5ec93ca7835aff91d7b13d9b6558548201d18ea243f6c6e561d510e4f59630b5
MD5 ded8b22d213131581137d9031e97dd8b
BLAKE2b-256 21c62b164a9c1fbb0403988db2ffed6687288fbaed944c8ad85082389067c4db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2f1cd23152d3925b56cbc6ed83c63539292e300aaa5611305957940f004af868
MD5 b7ee26274b1d992a206961d1be8e4a1b
BLAKE2b-256 44834f66c4914cce850df7459c64f5606c3b9067aa46af0ce06bc6ec98152997

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4ee5849e83ec467d3c9838c572b62c12c751d7921ad50a120459c8280384dcc1
MD5 7f0ec217768fe3b33749f32187284e94
BLAKE2b-256 27440625ea7d3020ace455acb0fd713f4302911d75601b6fba5db01888a2c3ae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0c9ee90e823b848cfcfd15e460dab26ff008e965b31fe7126665058dd4da4a34
MD5 1320db4da855edc03ba6e342cda80452
BLAKE2b-256 a77afcbb322311dc497f8b503d4bdd8eccc950aafebbe8ac6af10cd7ed8f2ed4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 320a916b113afa90490ee9ceb35b96f14157bb17fac70a99a2d9a369959ea495
MD5 cca544233288127355d52b6b6eca9c4c
BLAKE2b-256 e13904d3cf1bf1f47e8e81dd1fd74977b2b59a729cc9e6300dd2d0c2b502e862

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d19c6feef0edef11d7eaa7cd93d2556b4d3ec7622c11446e47043d6e65c9dd6b
MD5 cb8bb802a9539d729c4b927cd4d0be85
BLAKE2b-256 91628ff18dcc5fb6fc80ed23c99bdb2185a9c9cd14aee6db66541240031ef723

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b787543bd6893824370261626b098a954a9f13fae7443d142c1d176efae2257f
MD5 23d850a1c6775c674e5102e7f6144156
BLAKE2b-256 b8b9765668cdce202f0cde3ce8d08cfd0e07a3793eb24616eb1a539266b0f1a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c4d337e38d297b8d1b726e202caebe2e4f2290d7561449fa02c97691da0c62c6
MD5 e5fbf4e3f3d8ed55bd6fc05312b8ed51
BLAKE2b-256 2b5982fdb40f469c89e8285c2ce91f5242650f33b197b527ba060c8a46ea754d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e38348fec1fd6b650f01c73679af7eedf168a933d722b3979fab18632a3211a6
MD5 5f5b353783a9d4213d14a4b77a107e71
BLAKE2b-256 c73b61e2484002727488eb6ad273f63376402b83ac1e06feeb0880888e1c2ce6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b477a1c19a38e72ee08ba108aca9e8616f11cdd6ec70e601f9cfffd531f99803
MD5 aca0385b9576afc4e9591e772528c907
BLAKE2b-256 673fc81d500d8c2bd38de2ac295fd03cd963b21449d595d8e2efa4096043ea3a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 318959571957d01e1d07ed6fb82067a2cc6ffcfca34a9da6152c6e6087fe0e2e
MD5 9cf7d804a857731e7d8da79b46e0c6b4
BLAKE2b-256 abd24ec6aabd614bf788e0e2d3a270bcc0f476395d2c75794932a3ae5cfdbb49

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 ee180fbdbb59f409b56e81960d9d7d2fc08dc5b01b24e4d0feca0ec6cc63f72a
MD5 f8d62855aa8eb0d566b84b86ca25aeea
BLAKE2b-256 bde3adb3dbedb4bc07ce95b7cb9f97670f0657ae36e3759482c9b6e96fe48636

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4415d26c5016ff9c68d2bc714b4f377d1ba2514045b6cebcd630d9cbf5817ba1
MD5 a43bb98f154595fd237bf5da1758efcc
BLAKE2b-256 c2abe621507ee160216ebdf45498e758e80bdb53b85034b9c44d09d08e264fba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 43461053c5ff0f3ec1a302f893ae24b933a65438229e3ec940e9460ddb7841ed
MD5 1c0c0153f43f110a453d70dd8f191f89
BLAKE2b-256 372257c94f0cadbcb0f68521f6dc418f571e6a65bbdc275cd2c9cddfb41a5935

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6724844d14f51ad843b6608b23a3dd1f5a0a4c5147f553ecd5facc43f8527ee7
MD5 e0e19c321346914c611789d5ddd9b77d
BLAKE2b-256 261b581130764e1bbbf82536a2d444f954e3ca0a419446b966eac6108608aced

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 43007237aff9d8be8715ae9f04a1965807bdcac5c23e3d3c6c695fd99f9b9616
MD5 721472e50701674b94a5cfa6e3799529
BLAKE2b-256 4c341b86844f323cb73b3e3b61fb49c5e6c265b8280af421995b6ded4396b151

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 9b48be5427fd5d01399ac2953d070ebd160fec18ca703c121a2e3ea09f8b9650
MD5 ff7e461a91d67543325b5f3d955f2f4e
BLAKE2b-256 d58b91bfbdbaad0d01cc130f960466ab25e58241344484b925cfa4e6b063f0c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3e877c6c9478dcb9332b20232cbc1ac1e097a6713f5a6c83aa859a43d7fc0190
MD5 153aee5294905eaf2dc3191708fac663
BLAKE2b-256 e531a803345a1c6cd038f5862663c5f6346cdeb8442cf1041a4c252a45e1a288

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f51a609c6f7608b0e7a9f5e3c16a152bf8ce5a2477412f51c365828bc3265601
MD5 85b07f67d375ba28568cd0bb47e9caac
BLAKE2b-256 57225db3b3e242e151cfc7f141106734281b2d6213d67aafd7a037b08b9f6459

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bbbecda53ced52cce8befe42a34436c36e46fd4fae426bead01013245b9bfc6a
MD5 45af08f9d157dc5b03ba5620b2b3a6b5
BLAKE2b-256 07abb726100d0312333bb8a05671971380f5b1bb14d55360d447099e0ca88d21

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405241715182293-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 19d1260fddc830e1b268512b30ea87de029ecdff2d6f46bc1a6953e880d654da
MD5 9fa0a195c877105c3c04667c2eb55036
BLAKE2b-256 4a8180b50ac63266fcd3d772a90e8a802200dd6c1a46c58ad769c29fbdfd5a42

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