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

Uploaded CPython 3.13 Windows x86-64

pyAgrum_nightly-1.17.0.dev202411061729615378-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.dev202411061729615378-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.dev202411061729615378-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12 Windows x86-64

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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.17.0.dev202411061729615378-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.dev202411061729615378-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.dev202411061729615378-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411061729615378-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 6f21756d3d208072d1c01b8f27a92c204c42ed0abbce8074d6e6062359390140
MD5 372ac604ea2b1c0775ecf1e5a93cff0f
BLAKE2b-256 7423298f250856e8fcfee929980410fd580030afcbd858a69b462343dbded44e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411061729615378-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f45c2ed8de8f46c84948d4b7339ee01851c6365bb7f4d644dc7554982c265a18
MD5 66387374f292517bbab77ebc23a94eaa
BLAKE2b-256 1501f9ee474be69cd93146abfad44f885aaf3d704afcf89e52fda566952fdf85

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411061729615378-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a09979904e9038fee24054ddf1d67a31f9e8a1732b16fce72e318f97a30a01a7
MD5 68caa3efe2fe149ad3f23c05cb69c807
BLAKE2b-256 62680b21592f5acc236aee7e807d03f218c9511da7ab1e6f2067e483be74c208

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411061729615378-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 585c6435aad03e2f596147d622a6d5dc2860328020fa202af4f5aac6d3fc51f7
MD5 0d1dc17f20bd85cedf0f2177d5fb7145
BLAKE2b-256 beb1526dc665c6b0436aac1401b02cf25e9e15e82c0e423cece6ba07307d7048

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411061729615378-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 ebe73fb1c2561c93360f419b55977974233d4f3bf3230bdfa8923f18282bd049
MD5 5188f3e1f35dc84ffdc75f587b943a89
BLAKE2b-256 6851d9012a63f5e6d9bd2deb7e4868a41e89f2ab67b35b855d2cf9a7fdbd6f21

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411061729615378-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3cd26e74df70be935b54bba395a5658c1357bb7bbc3968e887702acc63af533a
MD5 b7c82d4ebe54393c3f0670dd6ce92669
BLAKE2b-256 31ad1748d0fcf188dffb01a43514fd97b4f94825159a0aacc1d1e9fc2889577b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411061729615378-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 02bac4c12bcb2234fbb5d2461a456bf1d2b202ff04e6ce663361ea173c265ba3
MD5 21e5c242068e6c2bf8d47161dfe67aea
BLAKE2b-256 a7f2be5b31205dd431be39ed56bde3eb2c7bb7f9c5b131045aa52a69d767d454

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411061729615378-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f6ab63d9fe2831276af6a3f8e48916ea566fd58d5c4c5cbc28fad67eaf98c085
MD5 ee061cef53ebc2f9d778cc537a836789
BLAKE2b-256 731425f343a4745e314e3630d892edc69d28efa6a96f25e71e6af7958eb9d7ff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411061729615378-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1842b395d6074d2e0ba92b1d1a7cf591ccdd6a1eb613046ce1fbb437d99721e3
MD5 a5814ca0992df7d309370b014f6a8446
BLAKE2b-256 c5d7735a6b42577067bd6ede694befaf4cf43eccd75d4c4c5dcea72cc07750b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411061729615378-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 30d09e4b761d280746dea4cd65368cbc713f547f54ef4316b0ab40317e530751
MD5 f8b7e9219b903965091c21418b86aa97
BLAKE2b-256 cb2607f7cacc37d2b391564b04f548103086cb56eaf6c03faeca2f4d96a8f3e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411061729615378-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 ed8efa940590fbe0a83e42aaa36976e054b10fdcc1c7cdb2aff89861e50e3080
MD5 15ee5dab97240e3a6a0ea1fd2ba50696
BLAKE2b-256 02e644d5c3a90ec7aaf9e726de81af6c4465a7e4a13587115b7b14b52981b983

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411061729615378-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4f0d700cd507664e74b7c5f6287fc480a24546defcde183b6ffa0b796ab8086e
MD5 e911136e21861d2e7098e0611d5fb45d
BLAKE2b-256 5cb962f3089f347ab4fa0b6a75b84a64a13e73dccd840c5c64703d02b850c5b8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411061729615378-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 78ac8b126e07beed0525dcd3ff35305b8d1f3e2ac92f24aca6d332d498657e8e
MD5 5a050c34a0a568feb2ffead647c3d3b2
BLAKE2b-256 20b8afa382315acf01d76a0016584de1aa003a27416a49c87a475d20ed91a80d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411061729615378-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9b561b87a59df22d4bd9f14b72cdcfb922013a828311d4e9a2c7f7d7a129e7c7
MD5 c46f5d1637c48f2f796cc0892f723522
BLAKE2b-256 291a5d0c78dc196114e1384904ba819ef9b3da0536da8f3dd0fdb4dbd561d891

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411061729615378-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e825bbe3f6ea42517fde5ce6fad0bb9a0575c586ad45001b0d6dd3d42cb54a8a
MD5 4ab4fad020688c4e41aa1db5f8a1ef2b
BLAKE2b-256 c074a38b506c281d5af66da8a183710daa8e0f973639c7f8d0367248f8ee2636

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411061729615378-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ab8060182d381cad5d54cb85392b74627ea45d5b7869fae3bee709e4a155ce96
MD5 7e4d0262b8cacb01af54b33233184f20
BLAKE2b-256 6a3dc3b064c6f24f8aafd87528bd26a55630d216d788422c682fc550266acbbe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411061729615378-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 27d8a0dc20aa0f92591d8049b3ae673702e27e9c927b57828a64bb8401da16fc
MD5 797791c317eae1d323f1c583ab51b233
BLAKE2b-256 4ea73bd4f20d852e164880a104b20a9dbd137901cc36c9820b39f9c9119465e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411061729615378-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 18fb95a2ebe2b438dd9f98cebc55d3c7d65d818e5c58b04af825898f715a2d15
MD5 daceb755086416e755801cc5740b12c6
BLAKE2b-256 5687c82e66058b5af80efa928b500ca63646e5cd87fe670e941e1149f38cce2f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411061729615378-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6601135bd58a264faba833618d8dbdfeef82bcf51dc19e557d5feec9f8133ac9
MD5 68b6a4b29827cc144ef070336645fa65
BLAKE2b-256 0edd950ed3d9e5228d5a86c0a5129fb38e5238ffd4c786806f011773bc8fba70

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411061729615378-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 97fb0f68c93b46febea1d532f6dda788f147c40abc993a9f92f74a51d691e2c8
MD5 d16a99c2a74edd37184ac16d9d4908bb
BLAKE2b-256 442e2b5d5952fe67e50cf7544ad04067e5b9b9f60b60d1ff77cdd2819a21faa2

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