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.dev202409231723794729-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409231723794729-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.dev202409231723794729-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.dev202409231723794729-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409231723794729-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.dev202409231723794729-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.dev202409231723794729-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409231723794729-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.dev202409231723794729-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.dev202409231723794729-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409231723794729-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.dev202409231723794729-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.dev202409231723794729-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409231723794729-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3f22235c21e7c4ea6944de8d1bd64c6045443f3ce0c162bb3e0d15d4ed870201
MD5 756d975708e31bb41426848e94559e4c
BLAKE2b-256 3cdff7f0b1b02701064ccd5989b440f7a755f5e8cde03b72b61d88a9a529a186

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409231723794729-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dabd10a96b404de77fb77c1360011ee72f891122d64cd96bd6576e2af6a698dc
MD5 cb0181af383b4373e51daf7173ce30dd
BLAKE2b-256 8dac05d62500d306217b4ee8fb290ebc9f3ba7c75087863ceca266ecbeb691f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409231723794729-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9aba76f82c4e8437f9f784a5dd3aaa9a9c019fe624439637c6db7b06db7b3a72
MD5 c513d94212611d91d59ba943c1f18311
BLAKE2b-256 5e5ccbdf7bc9b2430358eae33179638f065f6e8692ec078faa1118d56808dbe6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409231723794729-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8911d2c81c2fdd0673662e4c445753366660586bdc0801fbc888dc7b50a030c5
MD5 abe106cef4bff7770d3bafe7b3200d42
BLAKE2b-256 2c2795e748f03f828d182f9a20deb9a49a1f77dfd965c36f36e92776c6413029

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409231723794729-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 877673f01a5b0c342a1a03e0c4686791029f0e5ead55727886ecef82df81fad0
MD5 7be09a66446a3955f53983906275cb5e
BLAKE2b-256 cebb38f67584b2a34eb1f93584f17157793685d6e6240b86f11cf8b6600e5b90

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409231723794729-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f09f67be2dc2b444b60ddf08f0ae125ef87edc2cff1b82aed5790de6d55e3aa0
MD5 fc5964d993dc52ad737d200fef9c165f
BLAKE2b-256 79ffb0bf852605d6f101ec418a00065d78d182421177e0cff9288487fba3036e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409231723794729-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6164b9086c6ce74697e327599e6abc4ce57dfaa0d8ddbb8febc8e83ed020c41c
MD5 00bce83688179aa78fdcd04506b3fa1a
BLAKE2b-256 11d15a6da209cb857b1dc8d986f6ac5cd060edcd7838b0694102278dcd7f014f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409231723794729-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 778149ca370336dc6caeeab696c237656f93e6ac25eab365c4847034327312db
MD5 78508822a7735cf0e44344e8ddc9e6d0
BLAKE2b-256 34fd5f71b55abdc98a268f78aeb89d1417dc1fa9f108472457a52cfe13a69146

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409231723794729-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b120538fdea0ca00ca034c45a88d9db1957648818a0f3adce84d0c0a2cb659c1
MD5 6dd5792a77a84d15a3d55394e693e642
BLAKE2b-256 3d06b4d16d0bb333d8fb8cda25c600bf54cab2158495bf161634710e8e708dd9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409231723794729-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ae626608d375be3242764368d249eb82032881b656bde3908e789c81a76d99c6
MD5 0efab25e2dd013534401c218751d2a5c
BLAKE2b-256 75d37ad3d66c25657b82981f6a47f6bc74e4b5fdbab65bc1ff35fb83fb4a6241

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409231723794729-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1db7a78f551ffc98bb0e970dbe542d337f8bcbcf025539bd707e0b9a9e4d9a74
MD5 64de98bdf06bfb5fc690389ba6ce3c38
BLAKE2b-256 26280b35004941735ea003f4d49a88790b5fff62f709fd4a90b5c4099b3ab4a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409231723794729-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c30945281164e9432c2d5bc56d61d0c82013a285fdda506d269d297dffd783c9
MD5 d91700f78167a4273e6b08f47bb37c99
BLAKE2b-256 e9aee4e381635aeee821d3038782fb98a87775c649141b4a8a13b8a4b259b464

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409231723794729-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8452223f9f9dec97248eb37f6a9e23c850abd049ca8d824458885002098cb1d4
MD5 ba3d3c0d1545f7003d44fbafc0551102
BLAKE2b-256 e0a092e5252da3e8e34486b7267132a618f8a0466cc0267c8d1f7a83ab70f4d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409231723794729-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dcdf508b329dd6d290e92bb85cce2f802893f16879088d46e2e69df186059f9c
MD5 5fad3cbe679caadef68d2bf39e421321
BLAKE2b-256 562b80b7a313af2f4b42c3acdeff560e52cf3b253d96cfa8c366c2b9fad91b1e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409231723794729-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3883a79e5279cec7b733404547f1196e543c01cf86f5e3d126b3cd370f8349b3
MD5 1ad2b1b9f4a3b5c1181f31871fee522c
BLAKE2b-256 fa8aa785efd40e963b648cb8baf930d97b2af2e6b6533364ab11d2bf25ab19a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409231723794729-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 34faed7de4306c15efc13d2d73cbac1208da43577aef5183f045757600d79657
MD5 cf369168b0c120b9a21017fb2829f0dd
BLAKE2b-256 8efdc373cc038024497ed243d46e2f707767a6966dbbcbf6f670e1b566ebd4e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409231723794729-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8a963d84ba5182613a844d331ce824b212bd76c4f4aa95c30bb4162967c3821e
MD5 b071b7204fea85813ea2a1b9a46260f0
BLAKE2b-256 ab0b4e51e8d86aff3fb8246d4107531c38e55af49810b35c6ad6a6b6df39596c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409231723794729-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 efe05a8acf75fa23c883e7afdffd9ccf2fc88f852616012218da77fb801a037e
MD5 90b3a5e29e86bdabe02078b1e26290fe
BLAKE2b-256 60a95f2be9659ccf79597eb69f24ccdf50e832452bdd34879df55b214b7bdd10

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409231723794729-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 54d1b3747e7ead9cbb5b071c9fa928471c8b452b04a04ff7fe8de217b0d1859d
MD5 5004b7666b8c14bae808d36e1130152d
BLAKE2b-256 f8e1658a23bf1a20394af2bd081aec6ec51b2c1cefd780a871dc89c27f1ea71e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409231723794729-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 cf50f333a81ecef6ffe4116641e91b9ebec6d9aaf260a3db5b44a9ca1a6310f3
MD5 88bc19546241db59b2748a1a79a9b841
BLAKE2b-256 87984a9125a599854b68e24e2ce064722c23b7dc95f7baf55ce032d31d15a8b1

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