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

Uploaded CPython 3.13 Windows x86-64

pyAgrum_nightly-1.17.1.dev202411091730930665-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411091730930665-cp313-cp313-macosx_10_13_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13 macOS 10.13+ x86-64

pyAgrum_nightly-1.17.1.dev202411091730930665-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.17.1.dev202411091730930665-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411091730930665-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.17.1.dev202411091730930665-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.17.1.dev202411091730930665-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411091730930665-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.17.1.dev202411091730930665-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.17.1.dev202411091730930665-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411091730930665-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411091730930665-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411091730930665-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 4d263f6de066e118614a817dd10b944b986df53c10e1b7cc693e1ad6e65144ce
MD5 5c4a02f6ddbb46e3a94c7d60e8ea8b5e
BLAKE2b-256 3f5c5d9c28b76e5b92b336eb5f99e94b0c6d2d5d327b486eb3a3ec5719ae5819

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411091730930665-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411091730930665-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4c5e873bc28e5a06f6e4b397ff4eeca9a55c10e1300fdd6c1a002e12f425aed6
MD5 4dead883deb16b7ce80207911e1129ca
BLAKE2b-256 0682dba590e55ba5776ada8a988df1582bef1e153bd5e3c07990c9402ea35283

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411091730930665-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411091730930665-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f07e1529f897d5713e6bf9a3510af632df660fa7436d69cc2ef4e457ab07dcb0
MD5 4440461d0645412dbeabd9e76ad90c78
BLAKE2b-256 d882f6b026124d022311e62a631ec96759ca5baab40e8c5da552735e1482481a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411091730930665-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411091730930665-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 82576d55cbc7280decd21285f1b6090c813df30e7571eaadf3c566d91209e1e9
MD5 02c02f40759fd61ec697d00f4965e395
BLAKE2b-256 b051ff213b852b37a8d7c35339cc8610f2eb7bb882ad62ab10a27ab2b12d76ce

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411091730930665-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411091730930665-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 91f82fbf6e90b61810994a633c1f28c0a6b2d9c9e64c4becc3e77151315d40b9
MD5 3aab49d93480c39f11b3e421e8b99349
BLAKE2b-256 0ce2cd8caf50da7f062c9b5a37fefc92cb5da97bf6977f0a49cd2bd28b60afde

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411091730930665-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411091730930665-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5380d191fcc301d322573353b6c9822a75350c358bbd202ea19bff3950ae3224
MD5 27390278d796dc7b9bd202a5be14341e
BLAKE2b-256 2e07ec2e8a9bd71ffdcebd41869a63aa8cd456433af90ad615fd4ef6fc87caeb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411091730930665-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411091730930665-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bc187206057a0c2741d0dd6b3037d18cfdc9cb0e6c1dbfc3755ab57a1d0745a7
MD5 45a5006c0bacd79aca0aba07d828cc0b
BLAKE2b-256 9ec0dcf8d42df658b6a07ba658344ae4947890e2bd42723d9ae4a0c79c398c27

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411091730930665-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411091730930665-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3c4362e36d6db245f2a0a6e21e327b813bba4a6a0c86053b1a71d79888c3f3af
MD5 48b9be78d654c44fb40f17edadd70291
BLAKE2b-256 ad9cd46114fac1546791c6752d5ee89ccad3594287335cc1f7e6d8f9b839b25f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411091730930665-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411091730930665-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1743a40beb474a608e13392bc464e3671922aca101938a345932682a8a7b36f5
MD5 75f0e935810c606e1712deb57c5f18f7
BLAKE2b-256 82bdd0fb85d2e95b670c1c07847e5195ae37ab4785af22c858eb9b79eb3d722e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411091730930665-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411091730930665-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ab10593b4acacc88c4eb86718f3b54ea986cd02370701f9885be91114b6da8ef
MD5 eeb64b98daf252381506a20f33987c69
BLAKE2b-256 6959a7b6134a9403960d7eb5499b410cfee9620411d516b540cd86ab5031cc17

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411091730930665-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411091730930665-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2ca77960a718ac6bfb5efed9bb6fa2add48d96cc5914cbce16833b3480e97810
MD5 5b517ee27b219f5ae0f2a1d31679e0fc
BLAKE2b-256 c76227ede92b945576305264d6f522b8d1498af37283ffd30a3b1c622fe0f52c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411091730930665-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411091730930665-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 463ca3f3cba969e2c9fd9cddb4cd2da290c1c3a362f1efad265d8d90bac5a79a
MD5 5cf8ea1ecae8bc1156b96fcc5130d634
BLAKE2b-256 1eca12d9852dde47dedc847f7c0967d19b2d891b575d2a20c243d67c80c0991b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411091730930665-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411091730930665-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fdb23619fc9ea17133223e1d5619103b285bed51767bff8b72c3139b99b662a9
MD5 4ec1e1ddb1a7e85afd5b3a3e3c6cc5d1
BLAKE2b-256 149c2ad1dc8b815a7a73e63c9b7cb6ef61b7d1754bb6b7d3a3ccc60c13e02283

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411091730930665-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411091730930665-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a8d752bc27e096158eade22c1cc55cd649a55055c7fb0698113662cb58cdc103
MD5 9737a78651aacae1bd28c9488900503f
BLAKE2b-256 6180bbaef70933c7bae08708a6104920ef4976a317b6b71bba38789289411950

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411091730930665-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411091730930665-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c90e6b52166a8f66b55d5c5d775c5b5e053ea1ed46e7e848e8f70a7b6e87ba06
MD5 37b82480c8214902de1211f2baa74884
BLAKE2b-256 390212d69d70f8e1f8ca1ed5a75b4aa402ee5552ec92e2cdc7b5c8b8aa296bc2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411091730930665-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411091730930665-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ba9ae31419cf7eb5c49d313bf76bd2b356d81ceedb6e3e2086b644457fe96b8e
MD5 8968649493dae09d745726b11b3af8a4
BLAKE2b-256 158c1098a124b72119819988ee14a5f0aea9599fdbab952abbccdfbca0e82388

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411091730930665-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411091730930665-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c70c716bdb509934d7df7c0e77293eec5b8d50259338d826847a3ae58db0ca23
MD5 6800e59ea9e06e6474de17bf1fc9e70d
BLAKE2b-256 94e9d63178506f3d3a42cfe12b638830ada425490438dfc838b7f30a6c23487c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411091730930665-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411091730930665-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a09562dfedc463c80753de7b327de94f97b95d9bd1f1a58e73d30ba69862b400
MD5 7ec5f400f44fa26de7f570e849429838
BLAKE2b-256 fcf954ffc5b7e6bd27adc0d4b6a56e334579a457b9e6fe57c6c46c9019a6dca0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411091730930665-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411091730930665-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 83f23d9fed98d749fc63ac9755953f3492098db51d123db400b936c1f6b39b9a
MD5 69872bab73ede056cd5a68ea70ed438c
BLAKE2b-256 680c8c4d5c851fc6ef0b24b1cca9dc4ef20bca9893365175ba265c35c97900d6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411091730930665-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411091730930665-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3c1ee777c7b3f63369f37393b29fa079368706c9335d0544fbfcfdc689688eac
MD5 8e0de651721f9a6762303d22c2180cef
BLAKE2b-256 304cd617991378174ac89edfda7c100188f0e3c1ed5af2e3a896183a9abb3d06

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