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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501021731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 5b1a8649b75be97925d34b73ea57b9eb27d74d24eb14f1aaa8c030b7d06367c5
MD5 529d995f0a042bbdbde27d0156cf8e87
BLAKE2b-256 d25a111286c525db44a87e3953a7d1ddb14cb9c2d397db82fee4230c30807041

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501021731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 332eb4863589921de2592d961c9aef15306e2f222ea1e8a2a27c94e0300b4961
MD5 d7597e0edbcacfabeb35382a7fcc3ff0
BLAKE2b-256 9ff28e3ae336f88fddc917d465377680e94b22f5081fdd2369f4278c026e1738

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501021731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 db4843861f6655e99af5a1d610f8fac481b708a5a1ef69272f8f733bc1b9ba40
MD5 6b25e8ce46a33f518e4b2c3d3ce656ca
BLAKE2b-256 e26990ea6b6e809d34ab87157d1fef75cd468f9a251f7b58929adf96ff2b3dd4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501021731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e2aebeeda01131134c1d447e024c70c57dd865b757ca58fbe1485e67692d0d89
MD5 647ca4178ddf6123d7993c9a3f181753
BLAKE2b-256 e5862dc36a15797ed0abe638b0b73fd195e0bd20fec6dcf681c2be08c2694160

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501021731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 586b98a92b4f3424c78db89062e27f7a1d809c43c8886ea873d5a223362ca2f3
MD5 d96aae71b7ed5b2e687a531a90000d84
BLAKE2b-256 78fce28f325737c803891e928f2663b25dfa779da34fddebc1e7016d5bbf9f19

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501021731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d4bda3a45b42a668924ae50a1ca4c92e2ee13a13d5ab85d2c727579ef0cc9d55
MD5 48ec77e8970031d6644a30d0dda6860c
BLAKE2b-256 275b07fd4681451100882e4958e7fdeb978dd1e98bbe8194c965bae2a2ae45a3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501021731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4b9218cfed4bf434549c629feed934b1e9bf3af09e3088c0b826dac6e457c223
MD5 2fd47234f47352936f5e7e6032182f03
BLAKE2b-256 f07eaa84040e7a7cc0266f27ba0715b9bf259b5bf5d381e37b2392d95795af94

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501021731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a0a940d93e7f38756f72853a191c3d6fca0e9ea9d52648168c41b408b0165fe4
MD5 8a7065ccd00e293d75482eb05d8dd86a
BLAKE2b-256 bc8fed360c888b637997c67c28fd0345fa42b2b2a543bafc0babe9689323b778

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501021731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4cef1442625b2357567a89b835021176d2c1fdb41af6ab2b389056a54a41bee6
MD5 a7e40cbfd264e9edcb903ceec2cccd5e
BLAKE2b-256 70ead4fdb63529f5d0aebbf13cf590bb24c2d862ec4348994d1024d94eae5599

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501021731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2d7dcd1bd6494ea33cd2c64841232d76d7f7a6a16d044eb33ab496741b4ddf0e
MD5 3ca295627ec90b43ed14d323cd4802ea
BLAKE2b-256 79c5144499f54be14f2a7a72252f4bcdcc456862ddc1686ab58cfa2a97457faa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501021731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f37b39f834115b76064898cad8c3e63478a6495fae7e24324b0a6937fb493bb1
MD5 c9739674c39ed52ef7e0eab929f88b5f
BLAKE2b-256 c4e1716ccb2210327fb6a8cba4d9b05098b29389eabd7b9b2ab2a2aedc3ba257

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501021731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ff212b7fdc02a059a8f23e8468c9548dcee99b9c80bddd1cc96ea41662511782
MD5 99273142f8cef181ee9c019770b63647
BLAKE2b-256 3374f47cbe5767145998e03f5701ab86e9591dc5ceee2b3780010e7eb2b9f41e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501021731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a54245e397b83b210d2c8090d9905afb54f4e6e1c71b958fda64b140a2f794c8
MD5 1b7d8d419258d88449f239087adbd40d
BLAKE2b-256 0858971bcfa38d02329212243a3f71ff620cd89facea2b6d83f486183f053368

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501021731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4a84f59f2ee3b8ed83b2c24139a6488258185fd61988f494c19ec44870f64ba9
MD5 e09cc599337d0435450edd9f4ec157b8
BLAKE2b-256 fda97481a1023482c747042f15f21552b7aa5f15e29f0a6a6769d5e74545cc3a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501021731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9f538871639f9c45e24ec7b4f2f069e43b8662d6c891c877d71feffff2f01816
MD5 953b3449b879f4109de4eaad7e082c49
BLAKE2b-256 459c58a72e616793a8d2fb2fe110600ca9b5629447f09674ae20a142a943f15d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501021731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 6d770e8e5a622f3e33630f96e5ccdfa0332180e949e4707b53ae28bd70ed359b
MD5 c5bfcc5dda1ea9322e0341813b6b1c1e
BLAKE2b-256 5318d6dd099eeb62df28d2cc5523dcb8f75103c79edf13bf56b2394e67090379

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501021731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3b073d52d5be30aa1492a895f31ceadb3573d78aa60611c1a7eafd90b2882d8a
MD5 2acdc2529bd8acfe8c6990f9147b20c3
BLAKE2b-256 3b8b83bd9a0434b3864461b352c197cd35a9cbdad1915e9a889aa9773776fcb0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501021731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4773472604730ae3ebe65c67f94b1116152f547d8dc119deb860de05f4cb4d3c
MD5 68956977a00022dd1a18688ef2b0f12a
BLAKE2b-256 55fb653f0b78ff077c051cdc0753d280db191e11c197f398709c2356a7eba84c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501021731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a12796f8105fea107fa4bf084dd5311baa2772c1101dac1b8185da4f32fba4ce
MD5 6b2da88444a3706500d345664d2c3584
BLAKE2b-256 25777118e99fd7436f6e3627be3b806e358c645fc353b5cbc6406061399e79ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501021731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9b0b2a39672858e27a019e7ec7f3ea1ee2c5fcae7875671ba420bfbe0990df50
MD5 2068faac3ea8997be627a9469b9d4b90
BLAKE2b-256 d66a3c1a7bede7e415ac02d59818af85d20d35691c38966f245c9b1f58f775be

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