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

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp39-cp39-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp39-cp39-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 bffeceda6cfcc7dbc1e34f2f0fd058c5ca186e2122205f158d4412b4737d5bf9
MD5 66ed622f8fd989c0e99d9c07c5e601ef
BLAKE2b-256 12f4955bfe279a6896dcf9de26353688d80de6f95183e3b75f26f049e7222c17

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 deba286a9abbeef7e5e15463d80d9a4213a320e80fd82585b595e2e73d06cbcb
MD5 3b7e215a6ad6ba4ca39e66b3051fc816
BLAKE2b-256 177f752f793921d2ad589b9f1503bff9ac932b6d538d5c35c8de51cbc5ead682

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7a6207b5174e6dd32e8595464fc593c64a58202bc6108c1217733ce940f1d883
MD5 42905e09fb2dc618b036f0cca42651f0
BLAKE2b-256 12da5047afed1f9ffcc96d89c5b5cb82ea161d4ff5aeedb83bc5be787fded471

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 75d964877721fbe231de5a4aa7e8003007d5a0e8f39b4e367108de5d0e50f43a
MD5 13c04dbe991ed89542055545f9301b25
BLAKE2b-256 39b9a5582685fa8454eba3c05c852ada7527cd532d14927b9d9a5f8b3b393efa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ae687e434d7820c2dce994cbfaa0bd0d78a01f7ec3a11551e7dfd933bcb37de9
MD5 bc1371a563b5c71149f5633dfe249ca3
BLAKE2b-256 aacf7ee4b026cd366760fc7aa7cbbca38f778610f8af9c512a4d73c4296d6c95

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b0c0a8bafb8a38b94ede02bcea673236beaa2c437fa94545b596cd187c65b5e9
MD5 8cecc2f0b3fece9dfee2e2e7142884b0
BLAKE2b-256 a14018dca4d8f67d9bd49e384a9ae89c6bf7442d18443e70ddd386c3cb72a97e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8a7a4e60f83b5ceae00b0be4294e87947bababbb605e709d59dbbecc241ac640
MD5 4928b3709ff0aa19c7f2fb67ae84ddb4
BLAKE2b-256 88b50738d2289fc70749064fe23622b5313a3d31f025e2063af01421a9347752

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 900175457e58d8dee3381c2d6c523de5fb800ccb9f7b81c6d63b5531d4d8e6b8
MD5 f042885a504e3c204942ae31cf20797a
BLAKE2b-256 904f2f39c585c27e1de3557779d01aa7a4a3714343831f4faa40ef0a208eccca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0e3ab20e00c9e8d1c6211d5a7d68610ee961be705d676b8d79bde3ec929111ed
MD5 aa1ea5316a219da1fabe149e5934222e
BLAKE2b-256 54603e84a7a12239b007f0a7d74a54274cd5e0314f07b8252e597fdc661c4f30

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 84743ef5a7a016576d1cd36df059644966b615fff719c2f71bda21c84c75df38
MD5 9a5c2c83db3d394737240badabd32959
BLAKE2b-256 870d1f467285a69ebf2032cead84b4055292887f7605fd34a6ce3c5980362305

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 560668dcdb1e8469d8d9b505f222a0bf2c6b635d760b5c92bf9c40ac149aa8c3
MD5 32e4d557c16524dcbf2b7d45f41747c0
BLAKE2b-256 05a2e5e7b2b9fab091102066d83f9679654d4bc1c7aece2683879e95d8cf0351

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 35ce26c4d54cd86f24dfb0eed595c68dd3adc030e0c58217fa61cad00a63e528
MD5 e850396f5fa6dae9dc4384e31eae38ca
BLAKE2b-256 b1cbfc2584fe983d65b18f1e565996dc3137d84598f6f3fb6f0d2c1baefacf08

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 323af7c78181b9ab98a78b92a3b54607b007e6c5f0e4d165c2680564d323283c
MD5 bfae1f571dca441c8129721b452dc3de
BLAKE2b-256 04d69fe307b435aeab16fac50d31d9cad3dd8a1c11a86cb2d8a5286a7126b391

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0f241a3484fbd3867ff970468ce683488d79309afc47fb2e88d15732d519a265
MD5 188ffe86ebb9c73a01ef59a39ef41284
BLAKE2b-256 53d7bb652b35d32d4f83d729f073e01ff76903330611576d47dd9a8eb0f10ebb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 631bdc0ae8ad5f5a614874b8a1742434ed29dceeae6838f30ed6bf052af3f7b6
MD5 22680cc94c2a909f837a4e711df924b4
BLAKE2b-256 f73bc3984dbdbe8c2324a99b1c1da4dcbf428038394c20a6f373990c53790141

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 4292a2aa8f8a933e1601594faf7c2919c9581b924c4ea954c434497cac27dabb
MD5 deaa866a5c930f78062a6c4c4c31d388
BLAKE2b-256 fe2fabac6519f944210576d5654dc2cae73198b224b87fc2d43f60952e21fdbb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 89b17b5fa0058bfc1ed2b3cd2b3f222ba3f7cca46dafd1ceb2ba2104b66581f5
MD5 01eb38be0f188684603421f47704bc83
BLAKE2b-256 c3a936fb717c63a73f8d640d51ff22bd527c07362201707cc8d8245af4127a5a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0bd51dcc49543e63ae68a931cf307ca3d342874c6bc942bb8d238d10bf6e4aae
MD5 f3b36071ebf6ac48aa9c5254db7d19ff
BLAKE2b-256 a40d386bd077b1d334207a8d514b3b309c89c43d2d8c04b81a25a5d27daa5d1e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b4d5a5923f9b8a128e7d56dc05457059d282fd0d2d94d6f5bcfbd41dde9ad909
MD5 09f99c254c39761d732ca372784a27bb
BLAKE2b-256 b8eb33e11ad92aaa7cbfeaf7f5e064a769cd8ef5f0cb4eb1c411f06e21dc6489

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409101723794729-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 919f340b654190ac77dd2e7368ec6cfd7f531c92c17b329d023d7d85979e3162
MD5 b83e9dcfc5454eefecd69af658aaeee8
BLAKE2b-256 6d6a9d969173a1436af7c373464b29e76746f720d02c8367b5bfb7f7c6016063

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