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

If you're not sure about the file name format, learn more about wheel file names.

pyAgrum_nightly-1.17.2.dev202501291731932516-cp313-cp313-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.2.dev202501291731932516-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501291731932516-cp313-cp313-macosx_10_13_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pyAgrum_nightly-1.17.2.dev202501291731932516-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.2.dev202501291731932516-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501291731932516-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.dev202501291731932516-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.2.dev202501291731932516-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501291731932516-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.dev202501291731932516-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.dev202501291731932516-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501291731932516-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501291731932516-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501291731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 ce7b1a6e07fdafa955e86bdb49872138e26dbde528d1872f411f3f2a149ace02
MD5 eed693063a6ed6a20f498e4ff75dc58e
BLAKE2b-256 2f83e759961e1a0c4dd9bdaac34c80c5ce1461d760e39e4a71420a601f9ec0f2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501291731932516-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501291731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 be056b179b44821eb22166e9e231c71a6173481f98d10ffefd629156cceeb47a
MD5 23be6ca8049dedd6b5f805fe91da5ba6
BLAKE2b-256 e1dbd77dca9427da810e6252d98b110b953b1f5e5d884e082f37a11ef7b5fc46

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501291731932516-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501291731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c4221c54f6fc8077842ec6f85a1d622b52bbefb9ab17109403b78187968e7015
MD5 03e218b2d42a4b63563f160b9c422299
BLAKE2b-256 bd1910b3c93488c4a63c24273d3b3ed4484bf132f7ade44f5d60da7486b4c7ff

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501291731932516-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501291731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 079eebc617a21ea0355eeca6558dc4760405ef10bd9d98e6f89433765b265f71
MD5 5df58b99b72dd4e3b669a4de18b5f1ee
BLAKE2b-256 218c826047031f94d074a394c7cced436d9040d62a1edbe13e5dc4783643a534

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501291731932516-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501291731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 cc0e7161ee838a783d5ffedfc71e26cdddddc8668e20be1e8f1280c461c9fb26
MD5 ffef044fdaabfb5744f5e4934949d1d8
BLAKE2b-256 868a01198e01fe9b6d0ae8929b34211eaf5493a665c123d33279f55f15764587

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501291731932516-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501291731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b9ea6c5f6617885225806f653f9115e4540f9c26a264a95492efcef47d0ee895
MD5 0022e67b4bb9cc4f9ea9dbcf9fe9d2b6
BLAKE2b-256 143e37d5a9d13cd6923aff67b6d1d80424c88f5b46b0364088ef7f7e4cbfa37f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501291731932516-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501291731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a09c903a1480ab8b82e5a416e07436e9257746b322d9f39137dc00680e7af86b
MD5 3681b3893c38ebd955173e728e62158d
BLAKE2b-256 b9bf524bb6c1d42e7e694d49b2243a27812c376a7b68a18ccfc33277629e2d86

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501291731932516-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501291731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f2e16f8e720f1dc442a2fa94274deda95ca810c4b46c52ea300004039d5c1a59
MD5 b3fc30ffb183b4474c74af2a50357898
BLAKE2b-256 1f8193e006004463805f587a331ee441fd46d58aec1c3cef14caeefb4be6750d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501291731932516-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501291731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d8d658e2e40b222868221b9451799dd8b38fdf52ba14aa27a977fedcbb107c6a
MD5 69edfb747a8263726f3a9ebdef6bafe9
BLAKE2b-256 39e3d11e152677dc7b0e1fea6946d81cae8ead80048dc016f5ccf0cfd88381e1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501291731932516-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501291731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 871b39fa4a1ea40471c1f86bff642f9a0078515d6da5ad8c154e22a0dca6a9c4
MD5 450eb69bb438de2765903595b62c01fc
BLAKE2b-256 a3a9439a29c767a1d09df8ae809f2998db5f5abc64a823fab0692125a8a65b30

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501291731932516-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501291731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 9dd8dc43ef242c24202be8bbed22627a2d38f01ec519014560536213711c4433
MD5 cc4389a30b092308c0bad7d694c2c8d1
BLAKE2b-256 63505aea62e6fdb12f4c129ab5e65eb5792d930e674cd3481e25ee4a1b9ddcdf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501291731932516-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501291731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fd5d3a3d3e528976972e0c96088972de66c6355055e152574dff22b8c5556334
MD5 02e8ea5e3399f6d2c52994eb6e5aa458
BLAKE2b-256 7b462fcdf750a79741ba02b80f6ed118bd884522edc522de6aaca0d72abac7e2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501291731932516-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501291731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d9aab60815b8aa95b3c9ab70c855eb36851571133e179ef05f5dc04591d30999
MD5 814d4d71ffad68bbf818fa9dd30a908e
BLAKE2b-256 ab0666ad2bb3b3d63dec321908b1594e833f2ba4992d0b98aa7c9da7b0865563

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501291731932516-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501291731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1bfe4d0d4b3efcfdcd5ecce8cf2e4c23fddda5a4352c7e5e71022b3282a174ca
MD5 94d44898e71e6a4c1808b6171fd29ac1
BLAKE2b-256 2e9b715961e41cbec20f84db66f75312c33e657d8d403ed53412842e338b4203

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501291731932516-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501291731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0b8cf9065b74e9ab04d1c448812c3d5efcae1aa1dcdf68af5647c7050bf0a149
MD5 7b2a4067478a169a546afa0cbbf2338f
BLAKE2b-256 8d4b47ae169b8697329aafcb59280e9fe87572441bc49d642efd1c01354af631

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501291731932516-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501291731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 05613875cab75bf16284f970e752771e86ac29883a91257cc2e50493643d58c0
MD5 48d472bc58ac64833d6962145e0f9207
BLAKE2b-256 6b71900df74b7cb03bdcb310006c696215a8199bb62e12df7d323ca4accfe6c4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501291731932516-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501291731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3b573f966808dec6b199f9bb127bf9e399d490651740e513ff70e8939f53e5a4
MD5 8da8b50166345b2d32736f529c23912c
BLAKE2b-256 e38b23ff08b8dd3971b59fd4acbf224c9a2d772bf54324028485e8c0ba05865d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501291731932516-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501291731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 658707ac1639bc74b727d8b6cb5168bd473a0a9b141f586a0d4a247890fac37a
MD5 daa3ae7225642e8db520e70d3f7d549c
BLAKE2b-256 c89da019f594c9866cf07839cfc7f5aaccf89e91d2e6cd5fb0d259edb2ce8666

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501291731932516-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501291731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6e12c2687226983e24a08ddcb3e9ff98277d24a8cfcef155d9bfc90123b3a10f
MD5 ed1941c9582917f29e181bff7df2b3a9
BLAKE2b-256 6de0a33f913f2c9aec3f5df26026fa77dcf6385baef2fa37f3967d739e05678f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501291731932516-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501291731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 744966a7e5aaddf843eca6aac802f33931f783822b72a9236aebd3e92102f280
MD5 082604d68dbb7e324d033a6ae297170e
BLAKE2b-256 68d8b3595874adb66418817da6c368831a2d2b4ea193cebc414da6fe11bfb64c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page