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

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp311-cp311-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp310-cp310-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp39-cp39-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202402071701813464-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.11.0.9.dev202402071701813464-cp38-cp38-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202402071701813464-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.11.0.9.dev202402071701813464-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 adca833678aac018d4d7e2c0c7004e48f9ce3fc9843a0f64f3cebfc5fd68fd30
MD5 2f317f80b22868366bd667a10e08918c
BLAKE2b-256 0482fe9c4caa2101074b0eb8e4b29cec9975d46b05bea5e388e460b89b48ade9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 79985cc6a4b859c5cfc42cb91d3547c00eea9ce29951a72104ad2e40a6b3093a
MD5 5dce1fb1e4641915ffb85617d16c5cae
BLAKE2b-256 7551f46c37973c10dbad302daaaa90a899ac786cc0f88759acdfd6ae2d9b5a8c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5b4d0fe7d009e3315db8e10f67af45d359147138cbde8c40d54ad797a4b07ef1
MD5 4dc4c6fc004b9690539ea09a7b0dbffe
BLAKE2b-256 ca07db1e8ba0a192652ff8e297aafdda379265cc445e9b8e33ff063572fb6f75

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ea73fce081db9bc0bac68466dddf0b5ebebbe291ce5b29fbb7e15fb888694ae9
MD5 318f9103c41111342f66a082bddf693d
BLAKE2b-256 da334b377e4e41ebfe2b5aa01502f76bf71eab06b6488f8241785294f8cc6682

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a5b2e8e3f6df206985c9abc9200308a2231fc58682cd4fe36487744b5180f3e0
MD5 e5563ae31121fb67c67f9a21003c8d22
BLAKE2b-256 cf6a3a9c0039d8084c60755297fba6f3ae2564d14f891e0c8eb80d7742ffeb7c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 31a6cb46f04bb4a03a4274bff2f4132a16553e18b609b230f6087bce9d5997e7
MD5 3afcf5c56711353f06eb82666c2e394f
BLAKE2b-256 2dd66bc0e46bb2060a221bc762ff4e4d5719f364ec5da9f73db50858d6c476f4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 57b762e3b6fd64887db003292d3c294d03f04a6c02f1cf13ce266e8ad2020ea7
MD5 1f6fec82c50e85ce1c2015b829aaf894
BLAKE2b-256 abde798b038b464ae651b2f9ee65cf95a7545604189ff641eac33745487d8f70

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f0931e526942222baf1cc26fc9ee19a241d3a07c7dde9b2ecbe24ad1ec1ef02b
MD5 b9bff2349b305cbe89a4d768e492eb0c
BLAKE2b-256 beb737056ce17dca6875db9b16954e58fce7f0c31605f1ae02fb5af674da7bdc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 457b6acb90dc4087ffa571a2a98d9f0050f15dc7309ede458f6f220fada05ffc
MD5 c2a3dc1cdcd335938413903a0e88cd6e
BLAKE2b-256 72b38acf43c5275def5205dffa888fbcab24032aeacc2d8295caf1aee31d6ad8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 919bd0d4d1dc076d5b8d7f79c34dbb8b4d0e89f06c74699ae70f6bef1c824d6a
MD5 306e1587eefdcda639c3ba5549139862
BLAKE2b-256 b06870105a738a68f53ca63658f37cfca22c3b81aa175b24a690d0734d3b765c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5fbb73bbfaf859e38eb2e9177201f36e86ac2dd703e8c524a65258da5778c6a2
MD5 1464862eb785e8fde25953e72ad593eb
BLAKE2b-256 e96f6769383321d9f399163e561730725b09cf4192926e49c929b24b1448370a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9a948bfe12c7396b4e2dbee2d111b1126dc007d23939da6b0725f757cc9a3257
MD5 a9ff7b0ed7787b7f9ca7cd481c79f064
BLAKE2b-256 a5bd757cb9ef91199f3b10edbc38540ee6a5861412023cc09e0ea0d019d4191b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b480e6e130c7ccb8b7189739ff4b09624ad4a7cc643bb181640999bd9f3ef1e9
MD5 3892f7b95c4889d2aa10c3eb7d4e97ea
BLAKE2b-256 635743d4dc23d6bde3203c94bca3893a4d7c34a251737f38468bed5ba925f5d6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 880807851ee225b23c8f146ebbcfabd1ffde8416babd5b47ec1959845d5f4981
MD5 fde3fecd0f715bf0d70e743435ed0550
BLAKE2b-256 52d08acbf51c37f922c9d239183a99327a17f0867f1875193e623e44d558a20d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a75be56ee29371f08c82c6226f5166ae046f6bb8f7a61fddb73df20b20f7f789
MD5 86139c514ddd83e6493b7524022d29c9
BLAKE2b-256 b78bf5c0948691392a3124607f8badd9d6539019f8f448d376f649099760a8ba

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 9266504a8d06c3436bc3784f689fd5a570cff38c973145bdf4b02a8314d0b1b0
MD5 c205549b16f06340ab9ba23b2af03c5d
BLAKE2b-256 2a4ee8d2669939ba6fbc310d262c35f6378b8a96a657e57e8d086e862bab871d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8196dc5316581a16d9172c9f60095e8dc0af83a4c4484aaed199027087bc7f0f
MD5 14153033f53e6075e03ffe518ea0c796
BLAKE2b-256 1ac960183d768e6c0f5d513ceafe0a7382cf7a25f325097d37513a7b6b5d7948

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d54950d58e0f005cea0f7bdba39176fb0ca26c351587230d5193879a5389b588
MD5 853ff799f218bc651f1a185e13fac3b3
BLAKE2b-256 25ae8e9a6e5ebc842aae0090187f9400962a748e9a4ae476aadbed6fc66d590e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5f3eb7960373b819dbd3f29e8b87deeb0b94fc76f04d38f9fcf76a8f1b275245
MD5 e5d398fa2fad20b3b450055992575395
BLAKE2b-256 40798ecaadf15ac15811fed09b8f4ba16a87a4b2e23076cb6912bfb0279494e6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5cce336007d0d68177f98b53530b59789c682785ab779eed056cbfbf79a49e89
MD5 53f90679f8e96d95f6e6103854bc5292
BLAKE2b-256 e227650f4ad6d611d169ca5526b0a49355cab9123c06639bd84696e4eb39f87c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 2ed809c494702cacee469443ea9bdbd6dcda769c3ca2e9226d0e905e956efa7f
MD5 de47e774fd2d98a926b5a50072560a9d
BLAKE2b-256 a178baf8e41cd6a14646a8b2c142768ea398c34e68fe10d9d807408c9247d818

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b16144f7822f58307dfa8b4282266b5f39adb167825aa67383a2b6c20eda1c33
MD5 c51358eb22404727c727b95949dfa525
BLAKE2b-256 b2b82fd08fd4b7348e363e07ffdc5db5b15cbc18ef3923ecc4f95317eaf7fb44

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp38-cp38-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e90eb84338ba9845e0a15f3069e0e39f33ce59c06a289feebdcbf34e0135bf89
MD5 5d5da4a018872255fad79889fd8c1351
BLAKE2b-256 1b0f2f89209c15ba24b34bc6c3e45e605aa4319c8c9ce86a4abffa83e94d894f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f40de62f74c657bd920fb0917fb2d395fabecc71510092fb269e396cacbe4afd
MD5 9dfec1c86fe656cb5e8913191c3b050e
BLAKE2b-256 9f541b0f7be1427d27fec4519c8ec3baf9f1fc03e0837f457a00b300a5c17fd5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402071701813464-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 22c6f53f0d2152c3009dd506c52e577b730c90f820ab5acd33c81060eb9388c3
MD5 e58a29baa39678de0145cf42883cb5fd
BLAKE2b-256 6f20f967a3dbb253fd01410044ffdde0bf2fa8fe10f7f30588fb9d4a392bc88c

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