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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202411271731932516-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.dev202411271731932516-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411271731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 7830a81dc7a6239c32c39e21cd150d13203ae785ffbffb6b6c0c2268ad5e18a4
MD5 89b17c4de83217ac567c88a148250af8
BLAKE2b-256 88b12a737145488b2c4522d72ae2fddc555b662eb3e0f4deef9da425ebcb0775

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411271731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5c12a037674fe2ef3adc4515d21ba84d42be1522d549025f70e5f31f0e1fd62b
MD5 9ef10965831b17728cf8beee19e6c233
BLAKE2b-256 f613645a11b18698751f53732c23f2b6d7ae44250d35a750ed88b7231a600bbd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411271731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b4c99e2229854b7d7e1d42b3299f1aa624d069c75ecc603e0b59ec781a8d9ca5
MD5 bdb227115aaa15b895c252058a4346cf
BLAKE2b-256 8717469a8140766f0f5355c015c5ca04cdaaf8e3321cb0d993ba4403c0ed993e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411271731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1629c949b6b7fc253dce3846a2014a86af4448b953ad4f23a40f879be6befec0
MD5 a16413612c42851f229f7c2fcb0b3cc9
BLAKE2b-256 823bc48ef5c08c906ea9293a70812de118713c5c3c1e256e72af821efb1e600d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411271731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 009166ada3dedefbfbfa1f06c4e270d4721ddd7f24cc0e015a93daa76465de9e
MD5 972b327e048baefd68bec7e788ef2802
BLAKE2b-256 f0f581681556fdd0ae7ec0654aabe9fe2e5a5ecc43b5f011a4c8e33ec394636b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411271731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 cd88f40609866cfd9b3a5860ae461d01fc095abb9e2a6e63e18392b5fa735993
MD5 499f59c12b64867b09cab5fa02dab3bd
BLAKE2b-256 8ab1685535a0ef13b8c2343dd182c0b85c3ea61ce1e81c1e615b33d31caaebaa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411271731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 12fbbab69be0e588028e8dda142d97bfa9ffa0567e81290cb95f785c33971c06
MD5 0d31c8b3a0de7ccef956f17c51e88bfd
BLAKE2b-256 cbef0141f41774411b3505231c4b706f5b7c52c03be495fdc109425df389df4c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411271731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4a224dcf47f6d68005cd307edf4e6c491bd3b90f6ebea3ed7378148334177028
MD5 72129095e67aa0eef5fae6fdfa5f71c7
BLAKE2b-256 9b78693fbb7c8b77c5d85f214cb565b311f3dec0b68044be44993459ee8ad63c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411271731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d1e97a2cf86b8c05d3ec4af222ccb08d748de21a83a96a2f117c1f212f64c887
MD5 82a67364c9bd6c67fb185ef9e18b1f4f
BLAKE2b-256 c61bbe374c6e512ac3a62f76060c33a3c4da41aa4b816e1b4c5f0edab63a3adb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411271731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bf302afd8baa5a10f6929e0fc71d3ba07487f38cbe0606eb69c27aab7cc326d2
MD5 0a4c7fc27b7f30e134012e3bb7dc3da1
BLAKE2b-256 0958852f7df918c38062616a6535ec3ec536d3d080b1056d6ce330d4d1dd933c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411271731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 035c76bd872f718a1c3a8ff096c0966888928b5c2e207011fb5d8208af3ff7a6
MD5 d02a53b7dbbfca879a0ed160ea1784fa
BLAKE2b-256 11ea88f3944f0802380a521ddd578f002ea770c3cec9c1936f5f890bceda5973

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411271731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 deaf651967932123e8aee8066cd911ad2764cdfe0f7e61e393ae4c1c5973ae48
MD5 45d2606c36e5f3f5985d8eede0fb7f19
BLAKE2b-256 7e3546e27a5b70e94d2e49d27f4d51979534c84ecad677573fe32c850fa4f741

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411271731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c89d222e627e4c500781e8fd31ebdf5eb58691b1d906e5d9ae828b2e1094d1b1
MD5 ac225f3d8d7fd3ce92cda380ed1bba70
BLAKE2b-256 9c075a88deecbeb6693e1544918723f28d579a1e62ac453c3b74f3e4f43339c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411271731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 551c36d01d0a3c766924f16fd1f4e69e83a6c5f469f400898407b78c51fd5534
MD5 ea7b1f430ae65ba2f30320fb3b7a4673
BLAKE2b-256 cb5fc490d001920886c758ba252ec5223c5c40013fc1d1665d438ac0ec5291b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411271731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d806b6806c27bc2d3e3a74cf6f9d71994f23b72ba3b629ca69925e8fce3fa39f
MD5 9560059488d92e53f401b772bc6ad251
BLAKE2b-256 8df17bcab173cf3546939d7507d4d73474577459ebc583e774ed70f57cdbb4b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411271731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 53818aef78d4d2ecde81e5e9672837c3813d01bd689978c14718f0abb2e57d04
MD5 58a3f445f99a836776cb57f6928f8c60
BLAKE2b-256 7be01a676b07f642dbfc022773095e75356bd9a2023ee4dd65d441852ee94182

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411271731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c865b5c7c24bb7c43756f46478243a7976b5cee680766bf696790eb1d3cd665c
MD5 69499d3c2f10f8ffa0420064ef321817
BLAKE2b-256 1a0e41d7daa43265daaf781277bfcc159c6845a58a62405e76a88e5699d9c271

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411271731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7f0189f2037028e461a7121cdc307dd1ff3744f69fada2b78912bf1a5ab81a41
MD5 c1b4d54a77cb7ec57d80e28f59312d26
BLAKE2b-256 8155bd0e1faca9168123ac88f78edf20926d632bf224f49f52ae7122ad8765c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411271731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d74e43c9076176fbd18a9577c8d0bf03c0037be2d8cd0b60d7dd8f43006ea371
MD5 5756285c98594144a53a1d25894e56c3
BLAKE2b-256 8b6ae39944e13d9996396d0f31e98d18b92c6a31eee6bb61b4e2468f9eae8dc9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411271731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c7fa8b632aa673323d3547aa07204d65f14cbb58350ae03d47dc67dddb922cdf
MD5 bcf526341a67013621e4fc055a95c3cb
BLAKE2b-256 75fbe2bd41a45ea64afc5ffd48037e693412d8c7c68347ac4076eca4d0d704f3

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