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

Uploaded CPython 3.13 Windows x86-64

pyAgrum_nightly-1.17.1.dev202411121730930665-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411121730930665-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.1.dev202411121730930665-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.17.1.dev202411121730930665-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411121730930665-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.1.dev202411121730930665-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.17.1.dev202411121730930665-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411121730930665-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.1.dev202411121730930665-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.17.1.dev202411121730930665-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411121730930665-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.1.dev202411121730930665-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411121730930665-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 0a378b41af74020945add8e4ff1cd304f02dcf6cb663f2abffd40e5195eda628
MD5 f68983c7f1f0ad7e2649769da53cd4de
BLAKE2b-256 6e8391d8475e2cc5964aaddde0bc6f20c6071fb2208220946ed603492b31ff29

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411121730930665-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411121730930665-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 385b495062460a67c3ab5299c4b1a88b3bc944d044bda911ed1bd69d13e32ac0
MD5 8ea7c10b731bc120cd7e88a3b1958639
BLAKE2b-256 4ca46777b8b654a7a8dc658d28f62a4e67ae88ae40fd75f9805c051e87362f3d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411121730930665-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411121730930665-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ae1dce0d848266d01b3c5d977f00e5096e1e76f06b9a13c79ba1afd8e47e6dbe
MD5 1956b80d7bf49f2565e6b8e6a631eb0c
BLAKE2b-256 9aa2780b239a183448e66c8e8eccc4a6a8b4a120b7e896f0094a5a374eab62bd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411121730930665-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411121730930665-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bafee508759ca4cb15baa0ba00168681cf1e106569aa44dfda4060cd2ae72c79
MD5 de81e212d4b3a5d68be867428f08cf5f
BLAKE2b-256 110d92c545084128a59bcf60b20add678f71a047655fc5f9ee6bdb96e217b358

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411121730930665-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411121730930665-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 f49612f946dcf52ed7c2bf262a0fc9e66d5fd278b64ede5189e1641183a726fc
MD5 0fe505cceb95c494330c02490e6e5b90
BLAKE2b-256 ae5e2b681069b3e44dfb2017b098daeeb0e6612ca48df1c7e364f798947662d4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411121730930665-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411121730930665-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 7f726750b4a2d19de7d5cebdbfa36046d9248d1fd76f006e237b601609c15163
MD5 3f1f8e14de54872e115890ed9cf96e00
BLAKE2b-256 1d9c83b095ad0cc94fb507db5bf598b630d2208a8f55007dec911f0ff710b5cf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411121730930665-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411121730930665-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e4019adf4a1a1875b0a4d20d7e2407bb1f9b97f52c37f5ea6fb0989418b7a2a6
MD5 e760ecdaa3eb7363bc582e7e5d1240d3
BLAKE2b-256 4b5fa3a3261a7f5729e0b726894752109ce1f4ac89061922ab451bfe9cb5bb11

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411121730930665-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411121730930665-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ea146c0f5859d07e6f38f2fb8721ca90cff374128eb75cfc32dc73e8799371d4
MD5 baad3ea7559ba54aa9c0a5b70438ed6a
BLAKE2b-256 1949005663d4c7e7a3cb27a56528ab1ec720a19f58f0d0b9fc7bbfc1bfde3b9f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411121730930665-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411121730930665-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2c3c823e6067a6403f5895b9e442fe27f84f3b27100907a656398e4e9974fae6
MD5 afc90f052efdfb02d77ed369cd0fd182
BLAKE2b-256 60e54797990a822cff01621b8ffe264f278f3b7e77ec10eb355345d5c4fd8e88

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411121730930665-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411121730930665-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 39ccd261240e5ffa4b521d48337ebec4fd44e5807eaa754b249581fc21ca148b
MD5 a3297de9cf63acea045dc659c1a9e937
BLAKE2b-256 f6fd0adf4c8b03960a0f263d563aff4194ce18dd37882fae9a39704a0de697e5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411121730930665-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411121730930665-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a2bf9dd775988da67045387fe267ee1dbd585719a5350c5e43e2e8ac69cec6fc
MD5 5c88ac3172c6ec3f7d53da7da5bf3533
BLAKE2b-256 4eb302f612ff7413d6e83ee08a6db8054161d8c7f64931141009004cad2e3aad

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411121730930665-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411121730930665-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 562eea14246cca4ae534287e76af9321b243ac38386a9841bfd8e0ea29e07a52
MD5 54c1a81d7e4c69fd56bd18d80c74ee38
BLAKE2b-256 d33c6638e49e27be62e292227813a850ba2e32474b714d651b9661ae8f4c0aab

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411121730930665-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411121730930665-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c4d420b5d630c09fce0b83b4613220dc8d535f8370e2808b57488b8a3404e510
MD5 9c7846939d3fb3e6a088d14851daafe9
BLAKE2b-256 3696f3492d89209135ae851c700f91aa51c9ede8d9b2cada8f8c64fb551ee64d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411121730930665-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411121730930665-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 32acfa24ab8f4abeb4306e9e25937f7888cbf70d0e5ba2d4cc53577521f9383c
MD5 a71a8383a0bf61a27c385b9157dd3226
BLAKE2b-256 8ce008b53c3cec32972a80a60a341ba92334ec38ed79f776853d1a50e719de49

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411121730930665-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411121730930665-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4c0fa525239d3171307fc7cafa25a2c2c8fd9c290e12be29ce283aff59bca157
MD5 577743617d315c35897d44c718dd2c23
BLAKE2b-256 2a2a4d49aac839d7605c43119c87ea5bfdb5218d5561b2a45d93a8c9926b11a3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411121730930665-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411121730930665-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 cf30347a0ad3a6558710365fbcc1ae1bbf0778689c1ec27d5c0f57f453d6984e
MD5 1094797cc8147844ac989fd03b27870a
BLAKE2b-256 cd57313c14f3bcd3cdc30a420184696d53c2ab36950db6170221f751c03bed4b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411121730930665-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411121730930665-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ccf4c2cec1dd95a0fb09ff21b3a7c8d1a281cf4920ce18f6f6b3a7744e62c36d
MD5 3db43beb9a53336ecbb4b9b7c0d6d278
BLAKE2b-256 520c315f28caae304fd5fcb52c6d7ba73f64457204678953dd79e5ccb674e524

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411121730930665-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411121730930665-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f1554481d1bbb5ffb90ecd299d783e8afee2e38394248082ac252a1787524131
MD5 d948b9fe80c5a6f3b9ddd01199b0e3d3
BLAKE2b-256 cb2d9cdcb694f1f8a3ab9333ef61f81f94aed897d3dfd36c1b0258c652c468d0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411121730930665-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411121730930665-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ac0eae2e613999ba8c968412c8dac8ca1c308bc91559e2d86db20f8f3ab1abd8
MD5 5d078920b1fa35c9643faec9f3f93b9e
BLAKE2b-256 6f71cba3087eae7a9bbe63c3dcff80b000bb4a4f7d6bd2559c908485f8faabce

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411121730930665-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411121730930665-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c0af10c90eef2882043c159685b1ab53ac3d1797004adef149b2b6fad447d58b
MD5 1ed839befa052d3a608b50b88bf12cb8
BLAKE2b-256 76090771517edf424877487418c2a49b62253306bd06c193ad32bb74cee60299

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