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

Uploaded CPython 3.13 Windows x86-64

pyAgrum_nightly-1.16.0.dev202410161727562243-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13 macOS 11.0+ ARM64

pyAgrum_nightly-1.16.0.dev202410161727562243-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.16.0.dev202410161727562243-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.16.0.dev202410161727562243-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.16.0.dev202410161727562243-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.16.0.dev202410161727562243-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.16.0.dev202410161727562243-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.16.0.dev202410161727562243-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.16.0.dev202410161727562243-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.16.0.dev202410161727562243-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.16.0.dev202410161727562243-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.16.0.dev202410161727562243-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410161727562243-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8981a62528551153e2f32165b369e379e8194e00e49afe1ab8272eb2b4f11ae6
MD5 7feb034cf34dea56df3db98814a6fb6f
BLAKE2b-256 49da0d7d29938c04c6c1091b3a961296eab23f9b53155c7350fe3367a67d657a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410161727562243-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410161727562243-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 33132475c795c626346ef5940d4359559ecc434f95d3f19f2a9dba72ce63e07f
MD5 4c490c80da74f391e42754db9b19b425
BLAKE2b-256 4adacec7bdba79a9f4a15d5253f82a299931b3be42f0aa284e4edac20ca7524c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410161727562243-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410161727562243-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2d545c82e1dae6b776f2c30d1ab810386a7e825f60562b9d35d47d95c4d362ed
MD5 4c905f84ff55a44ba2bf48267ca2ab2d
BLAKE2b-256 4b0e486f966be4824f770c3e219383863f5a30abe7e9f3c2165fa3e147cf91a3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410161727562243-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410161727562243-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 98578b01b605abecd36c31d1d476770ab0bd9bc0ab5c6579d559455da7929c22
MD5 f538bd4b236a06f86755b8ffd218abd6
BLAKE2b-256 71393c12823a9b772267336270eb1e207d1b52f13a37fe8f603c2e8401bea174

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410161727562243-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410161727562243-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 cbb63bfbe340fd27ef55392a02ae2326cefee09a1a83c749e8af1e92894b606a
MD5 76c276bc0d4c85afe4ead0034e024319
BLAKE2b-256 44eb364c44a9b2c6e2ce9af6a97a4c0cf611d70c84a1f3cf8cb4dbc4d60a492c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410161727562243-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410161727562243-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 7a4dd661518094764058835fc3b9e2447ef71f636674d3c9b9581c9e4fa57366
MD5 ac0137ce146c072552819dc919eebd3b
BLAKE2b-256 dd181cee3bdd40d1dd1f395053049b006ce01a83b72b078d5ea73274666ebb1f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410161727562243-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410161727562243-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a7b18e71246355a3565b41686e73d5c18e39c888997367efb121da2e05799031
MD5 fb2c121733401c89963724d660b854ff
BLAKE2b-256 1758dbd872685a5deb6adc56e35093f68d311e3e30d62ffb994aea2dafe1e2e3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410161727562243-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410161727562243-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 55ac4cdfc4fea6468e4d7bacdb1d47104e7692ade69729c46bd8fa0e6531b4cc
MD5 463fb9046870cc12feb8bff5f90e5757
BLAKE2b-256 abb3d7a484f5745e1b80406b72d67138b86fa7ebc2f7b81d34734d36f09529d6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410161727562243-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410161727562243-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ec811fc720445c565b7610d6d0a771143b00e9228c7df63c9217d2ac54175389
MD5 6fa04cc892c8cc31b5e5eefc0c7fe08a
BLAKE2b-256 05485d784829a0a0f6e7f9d2d3154b7cc207539466722f59aaf8b65c1bd96873

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410161727562243-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410161727562243-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e86edf2a9763646642b1daf2c6915d6af9808ed89430b622b390902d9d3753b5
MD5 695139eb254cca77ab4c2fe8ebcef93e
BLAKE2b-256 6345389fda140684c2c5c0dfaae354183d02a1e3dbe4f4d8ea9a469814f64273

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410161727562243-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410161727562243-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 247d0846c7970dd7f8f0ab0af2ec71a5e2381183dc64d6366d47f259343c3a77
MD5 d471820003dd418c6f52bce4ebc5f559
BLAKE2b-256 ec071469a1314de15a2dd88b6f35a766dcdcac1a6a5f8cb0f42b6e1bbcfa1714

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410161727562243-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410161727562243-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b9e5a765fbe5741dc7d75730ada9874559a9f995edab476350f0305c2bad23ba
MD5 fab4937faf3fe1d4b1e936e13266c034
BLAKE2b-256 3ba9f9d42e3d9dff55dfa83d18f8a51149bc41dea5923986e19187a536f5f183

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410161727562243-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410161727562243-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8b835440921dc3f327d54d78ccd2279d20c2a54c6b39080fda3064fc88e6a249
MD5 5564c9c56524c92ea67c10192e4d6135
BLAKE2b-256 da1923e53225a551285ab2f7f5de09e98af19fc36a6e96f758f121bda4429a2d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410161727562243-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410161727562243-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 616077964a5e0c98afd3488667e7423139bc150cc8182e67fa8e1694197b3d4b
MD5 4b1d666dc80dbbc6fb8cb04cba5eda95
BLAKE2b-256 f5039d4328adb910c3a8deb70763805d556540eb46dc82633c7e98639f910bbc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410161727562243-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410161727562243-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9802e61df366d1506cac543a41050fb232a3f98ca1c15bc40c6eda30a90c5b5d
MD5 3c6b6b195aad81c8424b838d3de1c937
BLAKE2b-256 6d668645f115e3949cb872ca8c31ba50d1aa0fe9bdf31cac0d7de0b922185a95

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410161727562243-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410161727562243-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 6f220cb30f95fb0427d4f55a6d3d0ad70c103c240b1f56c3d058df29d33206b5
MD5 7ff07085c7477e5f17daf2102892e8f8
BLAKE2b-256 a47024c8d560dd9a9320219cedc6ca7c7e26b544abb8b41580ec5e2277515f21

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410161727562243-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410161727562243-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f9339321951e9f7cd165ac029a2f695ab8d04e95dc5d8c6564cad7f2c03ba82c
MD5 27ef58d2b1cce0ed9baa5d46d7a51fd8
BLAKE2b-256 79561af51cbdd1e4a5517c25f15a1b43dc465c683499088456a087e05e4b2ede

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410161727562243-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410161727562243-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 01c6741b1aa95f98ef4258e9d9d3c27cd8be7aab6e5e17b0f7c272793148f628
MD5 2464a89a71491ce34be6cfadf362cfb0
BLAKE2b-256 578e67afa7c06c42ab86c07337cd686c54d3f025153185496b4b079e63493d07

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410161727562243-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410161727562243-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ada92f663469c53a38d5f6bd18eaa1d71c52271fe8d633cea905a6c6ca34155a
MD5 e6f2707aeaf57f6f5c2081cfa4b9b30a
BLAKE2b-256 e5883e5222e98c12b106514f26f92bacc5903564295703e32c9e876e730471e0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410161727562243-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410161727562243-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 13ca06fc0639d637545e18d3d83257776fef7653f9f3cfb20a42d5c50b521e63
MD5 94b46aed4546f2f28d886067fc2cf082
BLAKE2b-256 3c10a2564bf3ca5ae6329f7fa590125be6766b69c800beb5dbef48051756a5a7

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