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

pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp39-cp39-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp39-cp39-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b086d4be18a1aeafc414e3f4c3ba35e9d72e35ec094a2d58e180d93e0f79d8f0
MD5 2d32fcd9fe0aa10536d3ee6e6c99a784
BLAKE2b-256 bfc7f4122c3c78bb01259242226e2f8c0baf046a007fee91cd40e3a069be7496

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e6c0cb479e607c61aac5411dbaa1568d50a38c7d6f66b3c7ffd8e28d236c2d6f
MD5 e17507a6822640fbee53790406c9c847
BLAKE2b-256 9186eafa7fe204dde4078730152ff094bf1944690c0def0fb1b84b639bbf8a1a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d9aa6207158326800464f2fa5b07754dbe0568aaf66bc3b3f14d295c35a9a7ad
MD5 474249aae3a09d024c62c28ae3c4345d
BLAKE2b-256 aee3f43b01f1d6182f0474f5630ae6f5f7c89ef3967f0622a578485081438507

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f61de22ea1658eef76e94bbadef9b8d932386fbd255e85904cb86028470d4c4d
MD5 8c2ac3002093b410b880b46f3a27e9e7
BLAKE2b-256 9ef3a45ef1dfe5cc141afa8d8378a49f80680df6f18f02527e9cecd7841263ec

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 631af48299fb72228082ce106171e0918b8d03f38009205a0db5db52797832df
MD5 b6d9bd2814661945b883bbb5eccab672
BLAKE2b-256 04f0bf8d7c4acb770a3540e1aa50c756c89452393f55d91434de3a053b937b2e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b14bda0c72339b7c496f0319c33118b2f6e5aa70ba00f2a87e4612624e8baebe
MD5 e7bb6b1a5ce6123e6996cb00b03c95b7
BLAKE2b-256 8e0d925701ea07293703ce9e80e16f6bec70ef118a17bea37238b541c2988e5a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e90dcef3a8dcbc82b4835898db815a863c841d1efbe0a205472de6e7d5e8bc6d
MD5 276d4ee661eecfe5ad001770145c8f6c
BLAKE2b-256 0c1af4b18fb114fe9914fd320f1ce0f75bc5968d89da40783850645edf04b11f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 48b108237cd520a63a8cd8a8fc1b8ba5921068922d5ad2621ae19a44ebc02dcc
MD5 6c928082bf57081de6484f46a67d451f
BLAKE2b-256 884df472bfe6d9ef6f8be2592b1df685cecd5251a97aa3b188c3c29634a168f1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 99d9d09c5309314205dff43970a039a06b43e625045e8c262a7cdec6c79df2d7
MD5 a5baf93893af02244a653ad004b084cf
BLAKE2b-256 6c77bec5e4e4eba169dbbd065294fa12c3e8488ed39a94cf1d8ca68baebedacf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5baad94a1846a2f92330963f54ea5dec5c707de97f70007f50785adfe62356c9
MD5 8fe6f1ff1da8ca86b3ee20383c82bf15
BLAKE2b-256 14996401bc483aeee467c029bd4615deb17e75c457b7186758f6dfe981404c09

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 275ae92308474053154ff6e551a2f4e59f391160bb9b4e311db77a1d63c9539f
MD5 4557f3b4c888eee7f880da99b1cef215
BLAKE2b-256 650f34e2a5d1be0196718775460b8c893701c933a261cd935af2ee1b18ff4cc0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a2ac686386d4ed5e593aad5fd01b0a83336e5a5769e3d64eab18bfcf145421bf
MD5 4a49f139f500bcf18ec03201e945a721
BLAKE2b-256 bc1e127bcc4ca2b03cf8610b54a61b72d23fe66445bfd3891dbf8fd20d76ebe2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a0f0046410d5c4b1c7f95771075316f0c94db83e53d90ad935baf1f116f74d93
MD5 3dbb30610ab1550f019395fcc65959ba
BLAKE2b-256 447e8187cb426f31c2965976102f110338ad5fd797e9fdc7c5100a3e602e0abc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e33fa8adc8b23c999d63c1691ad7365f9b2136314c04b202d4e1a2fe7c0dd678
MD5 68fc356f45634d30185738b2c234a0ca
BLAKE2b-256 660f42411d626684a84cd0a4f52906b8008e09abb01354e30a08a6f1a2c0dae7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 fea26e0cb473283d954bf5af6092a6434c7b6a6802851ba33e22c7847b822f4b
MD5 161339d61e250d3d3e3787676c7540e9
BLAKE2b-256 9ac1382364d3f8bc307ef4d9fd9653fa7637e33fc1ed06a38c8d14ab01d0ae15

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 acbe747bc12d59ce825b95f5a9b1f08ca2ced94861bdf2caacaee0f1d2d1c042
MD5 236d86082154300d0e040e910858d5e1
BLAKE2b-256 57b1b53cdaf3dc65fe83ffe9760b09d91d0da7cd690a0465a40060abe3a5828c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f743c5d0c140e7f2099e2fac050b048672b1319b0d2b1501b2a5127c993762de
MD5 a328a8fae9e13e613dc8182af21cca92
BLAKE2b-256 49174322efa6875ba6b2c471935a4d1d13759e8a7476b1e2ae712a2c3fe30a63

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 28b69cfa238f622d821d2fb0dccd2b3a6bb4e469b5f862ed32f822e42b2ea41f
MD5 8631d20c8d6ee90e19e6e38ba8bcc37f
BLAKE2b-256 b13dc3bf538847295c6e729d4d9263e0a7a2305bb9f6cb16cc2499bd9cae12c0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 60017a7e64a5c3c4caa0bc4066c925e14ce94c29498fd5eb33ec03e618028f6a
MD5 3dba89cb35153643da06c2bbda1ab65c
BLAKE2b-256 89aabdcee931cd55a613487c472db3a3d3c6e269bad521152805084cc9f0b583

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409201723794729-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 950863dbd611362745b5932cc22bedfe0b0da3d14279be8892041293057f1cf2
MD5 f0250e6e2153d32def5f0133f5ddb98b
BLAKE2b-256 220854c2049cffee05ac234ea6057f008c89772c0ace59d954e7b2262435b2bf

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