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.17.0.dev202411021729615378-cp313-cp313-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.13 Windows x86-64

pyAgrum_nightly-1.17.0.dev202411021729615378-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202411021729615378-cp313-cp313-macosx_10_13_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13 macOS 10.13+ x86-64

pyAgrum_nightly-1.17.0.dev202411021729615378-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.17.0.dev202411021729615378-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202411021729615378-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.17.0.dev202411021729615378-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.17.0.dev202411021729615378-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202411021729615378-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.17.0.dev202411021729615378-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.17.0.dev202411021729615378-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202411021729615378-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411021729615378-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411021729615378-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 2b72277f28aeabb165e1886dfc1bd8f6803fa65bedd0845af79635fe760873f0
MD5 8724e4daccd415f49a1b597d5bc2ccb6
BLAKE2b-256 347c6f72223f35db460ee8fb0778240d44f9cafb0c3e8711c8976565f222ca2d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411021729615378-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411021729615378-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9ea9ce0f13d40549400e812cc318f93d4a626a556ca9eaf97af53cca874175f0
MD5 7b1ca027344667d32bbbd44be589ba12
BLAKE2b-256 9c5784b80a84308d2622f8f9235e2c53a6ec50739a26f74a80661ba408cc3a1d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411021729615378-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411021729615378-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 cd9037a20fb474507d7d954fa054bdfb87516bfa57d01501e32d77823eec024e
MD5 877368193698f5c1ed196d9f0d2858b3
BLAKE2b-256 482556f33bda289e206c9cde608426550c9b8c583426505dca213b254e7d2038

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411021729615378-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411021729615378-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2cf9ab904838af6c725a4f6b71ef88c30991691eaed29bbc82d392800845b9c3
MD5 a4747f24c9bf6c8fa6631c34b46f1894
BLAKE2b-256 0ecfa8ee52911d7a8c3ce51bd619ab586bf97c6b330d58306396087a191cb4dd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411021729615378-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411021729615378-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 0e4befb18a1e5ae3e3d9470b936c28ce8ae615f0b2e993d2cd6e42b3724e8c4d
MD5 c21f843115ed8316e45aca5b76ad1313
BLAKE2b-256 ea645865fe8d8d1b07c6bcce76c011553f80c7e6f9f203a81aa5630e4f9bfa3d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411021729615378-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411021729615378-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d3af75d09a4b107951a018106aa5e7cd257d5eaf67b3a6afe4c75e34591bb87b
MD5 b14625dac56ca296622230b8f8780807
BLAKE2b-256 27f71fd4fc8716e38a7f0e2c2fd4ce566b5c3900a6265adda6629f473769d66c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411021729615378-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411021729615378-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e6904c5ff65b15adda38e3e1c342808ab9d55ec6d19042d9011c192d3a96f1fd
MD5 396a1597f6179a8d1a7c1917d695e027
BLAKE2b-256 d04cb86cdc45ed291ff65f24d6bfb52a532e41bc7d40eb782fc1f2e628446c19

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411021729615378-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411021729615378-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d9a98224eda5d346df99acb06d09b45ec9dc0e0e989329fbb6e5828a2625c7a7
MD5 78de4b4e955839acdff7468e24f700e7
BLAKE2b-256 15853265140d21e55f7a1d48be73398ece28a6d576ecb10fbe47c7dd6323512c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411021729615378-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411021729615378-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1b91cdaca6bedb8b917b6efca219bf1b56d76969a44d3d53b4178f6e6644bd15
MD5 94739af02c357b4e4d3bbafdda3e484b
BLAKE2b-256 f22967dd0f13a56f90a4296f18845af2b2a9eb7caf63b84e1333ae9292caefb7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411021729615378-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411021729615378-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 61e5614702d33b9919b375877b6b2d87ace30171cd3fdccc185be9ca41945e6e
MD5 4e9eee2ec3eb2ed3978d3dcd41de7e3e
BLAKE2b-256 069d7baeda4cc7554a4d073fbd280f02e2903cb0800f6332b05be9821daa4a57

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411021729615378-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411021729615378-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 808269e24f1d56b840702d1e10f8f3762b4ff70f0c3f9a0860d3797d5b55ce57
MD5 d939896cba7752e2396f96e2f57aa015
BLAKE2b-256 a1e7d5f5695e14d6a6e2dd8832c0374ed81f116652fb515e18c8a29e83779cd4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411021729615378-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411021729615378-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2c0577c85dbc03b5be86bbd6c8e8c2a65fc8315cb691d0b541269a17dc5e4309
MD5 158d60a1d1afde2a4d34a28fce8349e0
BLAKE2b-256 b690e5c0ba4a53de95049e5256b2e215cffc6ef00f89c3ecf487324b25d967f0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411021729615378-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411021729615378-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fb5d6ef8abf37a86418c500a3577a2a02a1d223802a0f752972845fdf24be97b
MD5 692fe0a44a109bb4f3f884103b67a893
BLAKE2b-256 ffa30f63b34a6668fa9565bafc2536ef6e1c79e2c228d0cc61ad7612f79ddfd8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411021729615378-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411021729615378-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 81ea77068f95d83b3da138d838e80cd77430151d57f579a3bbada2bb679a12ba
MD5 a0c75984c2c51f0d61f229afdfad09c6
BLAKE2b-256 caa8b035d4d69a51d6d08e96118712f28d803d4a777963eedc6a7d397335f259

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411021729615378-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411021729615378-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e557d19390a4ff7eff4b32973b0c5ae089e768afeb20d1db9b3956f99a127aea
MD5 12c7846f60a0a4d67400bce7bd6e361f
BLAKE2b-256 915b59a7a3f6ceb1ed4cdf756a6e8d3274ff972a86840485b3d41ab802fd0705

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411021729615378-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411021729615378-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 73a81da145c6147bb83cdcd80906df483bc004b332e46b7ec640f3e49b312639
MD5 28aef93f3096db1c96587b8a2fcc819d
BLAKE2b-256 b7ee4445a7079a4b35e13cd59fd01520d2400f2171a120a6f86e6020ef3c0154

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411021729615378-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411021729615378-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 008d6cda8722cbe4e443be529aef6c0bceba99f017f17a6030571cea91e941c6
MD5 466565eb2e29fe1f29cc2c4265fba160
BLAKE2b-256 3d06dc1b7c00df5f5955e5ef1d24591a1948032d6c8bfc74c211734e0c4c3871

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411021729615378-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411021729615378-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e4def31862d9e9d606cef2b1bbc2f3b5a526a94053544dc4aa6cb0af1bea71b3
MD5 4a631d162dd833d0de2e62bdc6a10ffb
BLAKE2b-256 b9d143acb6c9560baeb7e4ee78fe66ea8f3f1719fa5b494f7ffa526c20b08ed6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411021729615378-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411021729615378-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f7b06b4a17b54828876703eb4666117c2593ea124fd5ea141528128d0cc00355
MD5 147dde11acb9783ef82293434ad4597c
BLAKE2b-256 790ae3dbec03b157c118c5f6c86b0dac31b43403f840da67d47e25bfa5c3c5e6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411021729615378-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411021729615378-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2c71f8ae7c4c71b7e9ad242195445da6b56ad4fb844ffbc7d92be2567e55b0c4
MD5 01ec111e05f50a3780a9713878f3e00e
BLAKE2b-256 2ddbd8f3f0fcca067cb2fe3b12ff94635ea3196123a84588226ff986fec71c6c

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