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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412151731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 531afff48a53395201d29885638dc163de570a3e3f9de741b6c193c40be8341a
MD5 ae2588ead47bd17511b85dffa8bee321
BLAKE2b-256 09a3ddfe8b0cc25eace619b5c59fc24555bd9ca570e9aeff1a0c1cd8907b7c7e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412151731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 25f1dedf05903260273a6dfd943256521da47377d20d9554a9598748c7d0898e
MD5 0f95844f9f30ec60655e75a67776337b
BLAKE2b-256 2f61b9ca822a93a71f7a4a4f7126ba944a6f2d42b307896ff84fe4e14254803f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412151731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 dc19e96219a532516ff0987ad72bfdb09e0c81a5c00f2e2faba2c99ff3f0315d
MD5 4532b3a4047537cd357f3ba9001cb6bc
BLAKE2b-256 78c880dcb769a83432fc87c8c092bf05dec9811271513cbc73721261fcf43e0c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412151731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9bdd7fb009e89d3e0e71fe440b9fdb19aa28b2773d07d9095d7a7ad3bf61611a
MD5 3867982459dfc162c6ecbd2dedf1ab8d
BLAKE2b-256 5b0f1951f6bbc10e344a95e0948c1a6f734d6c02c68a7e2beff7980c7bef8355

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412151731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 11a0429d78bdc4c58e5b17c542e5f12205c3fbd77780d0f628be2ff83eb5b2ff
MD5 0be036563f39d6e315345ce44f5939c0
BLAKE2b-256 ea7da85579419f2dba472d4ffe9efe2d1d5893500abf9df12275ce2980eb16f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412151731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 cf8cd9a633707c87f58b95e7cae1fdf708705827c1bb4af2b99442bab6b587ce
MD5 f8dc0573a4c0d0373461425097747e92
BLAKE2b-256 7710aefd99c5f6f047e72dbfa5f4a7ab12f154c59f9dc0d51b93665d7ca775d8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412151731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8e783395ffb9942c0cd8ee87a70a0fd541d35f76689033139e9cf433796fa568
MD5 ce97074e445f8c7d00d3675b0c3f35a1
BLAKE2b-256 1604d6aae36b067aa590cf69b1217d6d607118cda2449d71252d049b4ebd6ce1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412151731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ab2729ef9987e9ed66c730b16d0bc279c15865a18f787e722c776e4a49f651ad
MD5 08e8f66664fa6c005fb532b700e92650
BLAKE2b-256 355c47d4f95f02ba12d4595dac4093be088f2644f253c2377128d2d5a879733d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412151731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 54aa2f4ab25650c53c4e5c8f9ce7533b3fb3e2c2b433ce2fe14c2a9abf7e8a88
MD5 c0f49234ecbbb9fe662106bc28a6dd07
BLAKE2b-256 de55627846cb46f79741deeb450919c25bf0d18d64c6b4164668357f6ab1910c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412151731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7b24a9923c5592f02bcde38443bb61be1fa3f058ac08d8a832be7883e441164d
MD5 c6868c46891398f4c762b2437170bffe
BLAKE2b-256 b5323bc92e74fc4653cf350800369cc0eb689dc8f91d6e6ed60d8d58174db8b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412151731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 1d800c40f410e6a93d995c9fcad5a92d87b13d2160dcfafe3d4649c5ba59060f
MD5 7858f1a2debbffe98355e1f20e79621a
BLAKE2b-256 a7ef5e4cacf849aa9e0c9b425537e0c0d4aac64d9772edd4a85a9b4f4b74ed8e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412151731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 43c57b5b9e6680ec75ad20e2ca2d14f714c5171513c89529e5f6a79391a61a30
MD5 be30f637d264f815c380554cba89ba30
BLAKE2b-256 e029ca666bf5faae84b3d1a79824caa6d397d21069afd17bc038000a43d026c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412151731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 be5c602b1bef01095a369bdddfc87b75a37cae01ae23485c888afef83013d47c
MD5 d307ee4896ce4e3219c182e599ac0e90
BLAKE2b-256 5eb237fa6501866d23cd444a3726e709292215c4363f47225e0d02b82639f7de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412151731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 41619fe2c013f280b68c6390ab888d0c27a1fec9ab53d645a0c151ac0b2e9eac
MD5 6c438d7f1e28cb538f4306b6d2b0bca4
BLAKE2b-256 f46229393d3ac7e6185efd77dc6c89012356bd5c5267e5ed9c0169547432d50e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412151731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 07a237537fd309b6c0b7c87b0616cfc954bebd18fd79154e895af4cb4e34a214
MD5 d3e51a871b83b04374cf900cd8698524
BLAKE2b-256 6b93743461a207ed4d268d21ffc6c8356f462b4b635f3f800fcfa71bb7278b42

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412151731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d41235d6a96b92cddaffa41c88422a110a339adec70de6af150ee70488c45dd3
MD5 d7ed641ddf96a0707a4245e7ca462084
BLAKE2b-256 453a59ac08b1153f37fb273542f479811f14d3354cf1e0c95d9901fa8ccfe974

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412151731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a598089b448183d1cb2001ebb934cb080caa29d82630206df754e9102b9dae5f
MD5 028793ff936db0579218b24245e4b4b5
BLAKE2b-256 78a8662888feae28057cf54d844f345fe1d00d41d5622e16f8ee2ca1eb0e8cb6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412151731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6f4c7829383eeace5b699363702956274b392d1e8c6a4b9ac251639571a0ca61
MD5 ea364bf8f427e5ca9d680373388923e8
BLAKE2b-256 1daa2be9106a54a05c7d9ca972710ba36aa03169465e2d0a7b1c114660968df0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412151731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9c027a17dbf88833e9423d0f1edccfa93992b6ed9a650fe83e5ca82cb2cd0704
MD5 d6541aa0000b19add5b189cbdaf84722
BLAKE2b-256 daed23ade959b9b5ffcf310f8aec3efbbdc20324a30a03eee25dede3b05ba152

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412151731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 65180980206c477b73e1d3bfcf44269100b6f0af145c3863debffc7ee7e5280b
MD5 b988bcb8015051579dafa606c1d8e365
BLAKE2b-256 e48a81167333b3000ba700f45980c1dc27559def4a3c0788ce65b6e3e53d1968

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