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

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp313-cp313-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp313-cp313-macosx_10_13_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp312-cp312-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp312-cp312-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp311-cp311-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp311-cp311-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp310-cp310-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp310-cp310-macosx_10_13_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.10macOS 10.13+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 1448cd61885c2e9981b30d8d61b5b850ef60a09492b941540124cef363da503e
MD5 8c5a276a5e0f69b835bbae3b3b3d4726
BLAKE2b-256 899f13e396a0131916f83601eb74344fb35aba2112abda306e656e52a71059f8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 12f1b209e251157e3c51cc546a1a39bd9cff50acd5fd30780b7a26be0d08f079
MD5 8ce351b886d7880ee045ca8198178bc9
BLAKE2b-256 e516d1269095144ccaf227bdc86c31a0b63daf517fa2a1761e28a2dde44ad6de

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e94de5d7b0c02864ea7f8ad33e9ac440aab374b15e24609b6e787973e1256463
MD5 ee3a4d4b88ec7cfedf0cac6bc960c60b
BLAKE2b-256 70077c93e86f6f12653f61cc798d7bbce75ed359402891278aa46cf32931df5e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5cb6f14087692fce501a56672e14fa905b0b2fe3adbcbf7164b76c9dc34199fc
MD5 f85c32cf5b12c225bed66f099b0b19d0
BLAKE2b-256 7705b052ccb6eea98305d58ba20633d5ac5f50ab717f9c9400f62f3cc5b0bd43

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 f9e9d714f902a8f1ca06305991848af06e71fc556fcf4b52cbeaad24cd6956d2
MD5 5aec235a68f517cabf850fa9f38bf3c2
BLAKE2b-256 81b2c6c12b722749181ac419d70ab7d50eb255af06db1e0d3e717a7ba2eab822

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 85b82b0881c0c73464ef1082218f3b68a00b52049b11154c22dadd228f0ca619
MD5 fd70226d77c800470f652149820380b1
BLAKE2b-256 6f12cc82e8060ada07f88ab0fabef99c6f8fd8421d345bfb7f49971ba14d5cef

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 177be4c996fd54a1f9a5e51a8faf5144800362544b9e6c9d8a129b44a7b1ea46
MD5 1e869ac95ae346df158cf185ea9ca91b
BLAKE2b-256 da54551ef3e5dead2a55fce37742eeb922f3e7be55d80c5ecc7b6dbf266c59c1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 625577f72b9b85460c053c43bc99412432d0b8bc70e2d26e6fcebfd98811b1a4
MD5 bdf96023b9d1dcf0ed1372b684aa5504
BLAKE2b-256 99099643cb69d10fb9ea94e7a5d70b10f826fa56289e792db6b811e22485715d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 af06e725d7512eaa870d845c1089b4067487823df7e221c02358a2dabfa4acf0
MD5 166572b8c7c845ac7d02a054b372d405
BLAKE2b-256 2905470c97ceb5163dad6528f44a0fe4bf24587333821b0f109951413f7c596f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f005cf7f3e848c5e0cbbbca886800323d783f8bfbefeda57dbc488c9bf4043b5
MD5 717017f46725546dc83b30947bb1b263
BLAKE2b-256 f93cb8d7b8c6888c16b07f7f69b64cd573a884750c727a5fcee20fb56449c076

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 bf00687d5aeaf26a56ad424f05f898b1aa9431b8b76550662663959a32d3d878
MD5 28ee9d60e04e874835a9010ad212f27a
BLAKE2b-256 13f14433a951e283984e6dbb9d96c88e3dfd00b6971da4308e0c4d7e1c65d16c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 465504560f5f8650910efac900015655a7db354bd84c539f8762aaa94f6f2c3d
MD5 f5f30deb8d701138f69296e81c50c98c
BLAKE2b-256 c0b03b6b0047194ddc587f8f2032ddfb169bb181dac330376d22a1e3e61c8024

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fc05241622cc8e6855698da6eeea5652954421dc338a5f16d95147ddd492ebca
MD5 1c23513784f570db0de93d6ac47ef47b
BLAKE2b-256 b34df81630e960c385b5cab4bd8146fd467e28aeb666424a0ae3393b48e58446

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 00b805bb74f7c53ab2ddf2f56af3c62ac17c56caf92f8df7053d6cd53d268218
MD5 0f24dfb5839bced22f34caf5c26991c8
BLAKE2b-256 fa017a86919ccef41410ddf03d9603b3947ab7140d034dc53376ceadbd8c4f37

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9f42ad5901871037a008c68a87c5981c7868373a435e45f3cf2519b1d2b69374
MD5 6ccc8edc30eb37de874d2349a33c3e11
BLAKE2b-256 199a593acc6526711e6f4a98d5132706b859bca2452bc8759ff3f0e9042e9193

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 86dfc406817b414fef411c66be3f41dbc7eb080da504157f4d17048fa81c0066
MD5 7fda7360bd124482715f3340556d8f15
BLAKE2b-256 0453e28589f89b97e65911c69a6f2f760fd4b4925e53eca0d03b558e3390db74

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 686e6f9756635d5783ab1fa84767ff5895896dee67932d3e7360b45ae62384a4
MD5 22a828c3f568a1078c7a57f897d39c4e
BLAKE2b-256 b2bd2f55fd866d5192320943db29bd71d51bacf810718a4173cd01ff252610e5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 744e7982a241cdc443dbcdd385c51ab46a70f5b26e3dad9c66ff9b57f40ede69
MD5 7dac8826df32614e09b778d48d49df3a
BLAKE2b-256 e2e90ef9eb15f9c1f1340ea0ca516a662255f756fdf1c634330d8b52d7cbfba9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0da2f3eaef4ed5b8ba9b13cc288e26c279c7a937e7394a6bc3cfa579e509569f
MD5 f7c2793d7fc9009d076a47a5b1174ef0
BLAKE2b-256 cc3c6a4d75b6571bcc9a2e827fc6a504d6576a659bc09e1aca7a0d772cf0fc9e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp310-cp310-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502211739452835-cp310-cp310-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 d715a5c26c2fabb85bf83411a32bd09d3d92c18d0ff7f0062bbb8911ea24a285
MD5 afa843285d781f268a893a89db056e77
BLAKE2b-256 5c305d7fc7d27d95583f9d81d7a2b184abf899b8c669936ff877ed9e6bb71ce9

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