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.12.1.9.dev202402191708115962-cp312-cp312-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp312-cp312-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp312-cp312-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp311-cp311-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp311-cp311-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp311-cp311-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp310-cp310-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp310-cp310-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp310-cp310-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp39-cp39-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp39-cp39-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp39-cp39-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp38-cp38-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp38-cp38-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp38-cp38-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3f70ef84ee30f76d362e9ada8197c7bec853d847349d6b3e202445642dfe6137
MD5 388b01a92fee80c8c311e5d278bb0b5f
BLAKE2b-256 56cf46fb6919a7035ef2ea070e9dbfa807d9a0d0ea44dbfeccdd73727a55919e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3fc71e687dd60b4ca3ec8c0111437be7d930d0c9fd9050332eaab45e443800ff
MD5 e5ae3f7308df11b784f29295011e5677
BLAKE2b-256 f2a378355b0574eb7cc9bc588fbf855a60cdd7175c55b6ac956c26e61b6a1523

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7fd00fcb328246d80fdb3977da3a0ceb6edef4fabe5c1d1706c4048af19e019c
MD5 c037694dc7bad5cfafffbc460bca1b05
BLAKE2b-256 18588135fc3ff52d29947a5f720c0a05dc3927d16a7c40b8defa32c60473f4f1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 52a76ba286ad637a832f13559fed8d57f7812b84ab6c7a435b3d2acbb9034a24
MD5 0ad8ae327c6beca575502744d322a64b
BLAKE2b-256 8c812e1f87e5ca7f0bf98d6ff034af90ecb045d46245f9b50f42357d2ea7718c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 adea431a1cc80850f2efe3b40751df31c4293176e81c99bc8458c38514101f14
MD5 9832171d10bf993220c66292e162bcb8
BLAKE2b-256 a629f9d782b8beb6f3cf93c92355fe4fbf99b638310778e058c52494ffc8c418

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8c511d8fd52f2f90c370075eeddfb156aa77236b3b30cafbc29a818e14c7bc8b
MD5 606ae9ea87d56518197174973245c425
BLAKE2b-256 d4e73b1e8b4a38845fc22690e8781985aba43294ced19399feeb4c4572f54d76

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 341376f28d7fec9f37e51050519eea4c0b584ae1552a6e18c5a972186f22d52b
MD5 885e0aebcbc8277266aa1bde490d1968
BLAKE2b-256 18c08b3923a0eb64a7444917ece2961b8ec0e5d856680fbaacee2707604c8991

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 57f57ed34e55ce778d562fd8fb9faff622f037147c707672ecd607d3318dc56a
MD5 5f12a82f79efedeaa0df8b9cd6db6935
BLAKE2b-256 8336991f8bda86fae83ca645ae5bb9d62c054dc9afcfcf629992a33fc9fc8bd0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7ced7e5512d1fc4bef526c0c090bc8662aae4494d08b3fe8bba267de18d8e8b2
MD5 49ad53b5974f7adcd6432a850bc375ed
BLAKE2b-256 2dff08d4ccd55955f033ade0f0ae9a1ea5bcb8fbeb5c07f980036c17298d1f68

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 00f4c0b4002a63db5c46b6694d6d51769ef7e778569a855e7e6a3f93f9a5eaae
MD5 2e6e95d6784fe751e9bbde3fa8ab31c2
BLAKE2b-256 86e59996000dad9249f7158d461b8ddcdded3fb30876fd7c8c7f11cee6ae3d60

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7f095705696e50332a60ef7ab2dc31acbf8682f9d335642bbf6121e5404eb8fc
MD5 cdd4887f5c1f0f1550cf6d3ec65df6ee
BLAKE2b-256 00edb154ad7e1802a131a6bbdfead8f02912474db6f82b0c5bc5123756ac0c41

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6d0e5f54584974f5d4e3ada0ed0bc1319f6895faeaeb33f9d58f55799f3cda29
MD5 7c43494c23cc86f364634746592c3c0e
BLAKE2b-256 242193b9f878956b5bb1c0617e45ce5db0b3cb95ce4f96ac770ef150856957d2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7b5eeb5896bebead22fe506aae66d7aa289a9ed758a74764a2f85e11c975d29b
MD5 b0c9fab1ef75497bf76926e64e8062b4
BLAKE2b-256 f3b224793053a23c3b257b4ba59c7a1eb262a83abd720fc94a68bf6458aaa9b7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d34d1d802cc4a5cd905fd89a4f72398ccbba1d1f6eb0a07bd15f3bb26535f660
MD5 607da5f32c366513d6903db617661e41
BLAKE2b-256 4c80db36f468dd1a3ef0911658f49d4d3bd96ef4fb6aff867b268ce12aaa2524

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 fba1ae0d3c34f37d463027d128c3273a03d1a425e3b315bdbdeeea6b958566fc
MD5 f1d068287b8920860cd4de83ea3b4734
BLAKE2b-256 8cded14bab95b97959e29c7fbd48b1637e8c8c725fddbe7b86f91e0196724cc3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 c7a6ad11611e219776d2b8fe92c873deb41781f97a59ef52564e8fd5f150f48f
MD5 761575e4277114fa32b6f4a1e2711d9f
BLAKE2b-256 c85334e93804c0e2185b7aea0ab6480822f7da30d81eb6c1fa4a83fa345578a6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d2d376d7f37e6972544d7a6bba0b7d0c4412ec9f2f5307ef20b943eeb3a40f25
MD5 2550c7a0e63cf3b25297dd599aa6f045
BLAKE2b-256 dcd62550490ba74545f30aa55b10f703b2ab31aa722ced58bfe7db082bcdc206

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 91d51dd7bcd34a70a3d24805cfcc9dc32bdc4a3236537e3d51f52252a123b779
MD5 e7c78f8c296b2b1fb26f40534197ea61
BLAKE2b-256 8759ca83f5f5dfd7533be49ad9d0a4a793c678bbc7a2e0d8d0fa3066f71aff93

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2addf8227db3d429dee1b31ff164a8d33714407cbced2090598c99b739ec7257
MD5 83a9a00853d3000d1918345f63acd148
BLAKE2b-256 586784873a1cac41b0bb982c12390d4cbe9f35a9e911929f6455d2c9dfb2efdc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 80fee9ad9f2e81db6a1097e5622a00e657091ad816032845ef0d8ce73fea0edc
MD5 5781687e1a46f828b93b69c52431acff
BLAKE2b-256 239f5a241e1c061b5d018b5acd888043a662717835bd659dae51c9a725166b06

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 0e3b77fcc2fb07607fddc5245fa77bea8c9314f0c292294cf5dcdf456260f126
MD5 d8124bbc03d0fce766df9749bc3ffe57
BLAKE2b-256 890e87cd8006f18bf000dff1763044a7909dfe72770d12d46003cadc380835be

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a5c211f9cf8ac5a3504f1dcc658e6bd94b9625302c241696243883c45006a9b0
MD5 4600a6fe622121d784fb6893c87532f0
BLAKE2b-256 df5d405d2490f4dd7752cb6e9bda403da8d8bfb0b4236b7a8ef24d43a69d8cd8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp38-cp38-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d4599545e3a775a5ce21e37bbbb8947f13947945059ad613c503ab2abbe838e7
MD5 05e80de61dcfceabe7e667d2e665a797
BLAKE2b-256 5e858129c6dfbcd3edb523fd8c6e305f06cfeb44e6d8f364d486b2d5d4a738a1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5cbcafab1a8382333c64985a3ae319a30bf7010a26eabf009595192eaedd631e
MD5 1897e059c7f4ba62869fd17a8fdf1669
BLAKE2b-256 0568052b8694df3fb2939700a36122a969f13efb7f15618d85ba5eacaf7498cd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402191708115962-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6f390ca2baa176a2695de0f77d71989113228f6786c34b42151d60803c5c9c7e
MD5 d6307747ab97dfbeed7d3eb894f2ca5d
BLAKE2b-256 1e77fad55f154b07abd7e42e62a23b576e5f81f2c4328e99e14098c8158a7ed9

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