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

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.14.0.9.dev202406181718113029-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.14.0.9.dev202406181718113029-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.14.0.9.dev202406181718113029-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.14.0.9.dev202406181718113029-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.14.0.9.dev202406181718113029-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.14.0.9.dev202406181718113029-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.14.0.9.dev202406181718113029-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.14.0.9.dev202406181718113029-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8b360962e6250c36a8f8e34f2a73927d190f7869a4f7da4e0bd7240792cae815
MD5 27ae0d49c02a95473115353f6a2732b2
BLAKE2b-256 2cf066eaa3b34c01afc23c9737320bd0e5e95f44af6e79bc3b7e801544241f80

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a5ad89828b5815e4c05070bb108737ae709061500172ee16a0d52612680fb636
MD5 7c95a58374f989b3afcd2096cad61768
BLAKE2b-256 be8a9812bfae8907161cff236ea28462a51a78fe8df3318090a07bdcbcee8178

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ac10e232d05be05b8a7ba8618f23b352718b60871865a3ebb41ff8c99ebe2501
MD5 68eda4ec4935c52f5a3eeb7029f0ce5e
BLAKE2b-256 225657f739fd8708a9fd01b70eff6d266449837c857524ab370df680a15958b4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f315aa5058e3df3c247da7da62287827fd72ad80c9744df79819b9df5af340d1
MD5 1d96c85d66e1e211ec373b3a83738818
BLAKE2b-256 3a8a6db1b17f38a15f1bad7811f50422e5144f5e3917da4b8e77d9a6ae111224

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bf449532c4a55b41d569498c5d2ec7f48306ddd35fbd4fca3904834f39db97d7
MD5 833963524939846fcb356c0e02acda8b
BLAKE2b-256 55760e9a0d7486a97db0927b2807dcd8755cf03c661ea2d6c48121aea18385ed

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 79115072a6fb424496c60a0d45a72614dd109aa3bedb351cfd94b4a2eb1b3abd
MD5 0c8cba28f7280221881a80bae813f9dd
BLAKE2b-256 32ae8006585f5c92bfe8f9238816ce3f10ff468358805ac79e24f80101148691

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f34a0e3af6041ade64c3e7c709f9a17c579cbc559d3c1f5bf6c903531f06bdea
MD5 5ffe1585f25c26b5fcc642fab8415004
BLAKE2b-256 4bac5783366e190f1c0aac0a870c13576dc90b99da2ab8886237b1907f5dbccc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0cd0588c7af2d0e24d5779c4a472f5ccdfe39bac3715f9ad5e801df59793bb5b
MD5 baf339a67f8514297ebc22f0f9dc09aa
BLAKE2b-256 b53a14254f7d69348bb58017cace8f0e0c4ad566885cdf2762aeef1796517b25

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6046fe1468d41605dc6fe85bd28e9e04528279bf8c3d9029146d3369eda79053
MD5 bed395d3836ca3badd482aaf8e7cc433
BLAKE2b-256 9f736e7f010a3d16af31481182238aef4483291d52ef039b6933bb4104d98c6f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b2eae75bc53a1669c3e6e9a20dab01d5747d03b4f0b98a59d0e9572e103be271
MD5 cec0d147fbc1bc136ddc89f7099decd3
BLAKE2b-256 add2e957e922191e484291d6546d2925983cb2c13f4673271b5863ab47986d8c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 9114afd50b4263338d5d7ad5bc8eaea94365e8dbbaf7e286bd7fddbb625b8654
MD5 5b0c13c1d0bacfd48ce076cbd3bea3f0
BLAKE2b-256 31da4bb74463c96fa1fdb1ab90dd92d7b74503715ebe1a21ed3bc434c4452c99

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 071a30baeb1a3eb456243489d97d009a0d5e82744ab6e00d14c075f2a80a60c4
MD5 99e342958bb8890a83627024819db336
BLAKE2b-256 274da4d29aa5b4a84ec827c293bf4c4daafd2d2d2d150d47b8490db8c13a5da7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 49a5de7ab4ff75f7f421da096e45a7dea2198d69bffa93ce1d58ab00d91d5704
MD5 645ba53e6961dc9103f813cf7bd82a89
BLAKE2b-256 fbdf5b08b3ffc455b9d7632816e33b2f093cafb94ae83eb36df35cb40ba0f335

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0c574ecb0e6ea8fc44cf2fee1442d38074b949e6fa62d68e3a55a5f01a3d93be
MD5 32fd56dee2c7603d5e7da57d52e16de7
BLAKE2b-256 5265c7246c8b9cb68d0ddb5b21f2fbab87315be392518588514fd248b71e5b23

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 12a75be6306f541c773eea168d2b21e61c917761f8f34ae06a9b64e81f391de0
MD5 07a00ac2e3e0d40ec9f1da4d3d392f0c
BLAKE2b-256 1df803b2ff214d46a8cfa3aee3d60ca56a70c165732de5ff59f21b72032b4acd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 76e5dc1aa58c322f776c1ea7c78d17863d71bb57b8769e301d7bf1b75e184b12
MD5 3961ebfa41015f12c7596bcccf2dffd0
BLAKE2b-256 fa26d37b59176219ba650d39644a02a6e3bde2cabf606db78b3f02f88fbbf7b7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 51a3a8e00913828c4e7bfc38a1e04e92144dad4b0006f766a5b7e02b08f49ba0
MD5 8d21485178266bb4ee1be9dfa713dba9
BLAKE2b-256 d676bdd446bfcd5648a503a4a034ac923f24ed67c2f92cef3500923796b7634e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 59ad7e9cfab14089fb4eb3d6897a888e5c48188bd918d75e1d02fa4dd8d1d852
MD5 dabda9975b210f46ddf93623dd8a77f5
BLAKE2b-256 5f496ff7281ced688d998405e70994cca5513ae2387f5a4a4a4ae41c97a419ea

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e38444126f0fc56b5e6391e14f39a8b3196f437b5f320afa3b6f7352ee55d9de
MD5 81d37ce8abf8cbf73548e26f236f0c84
BLAKE2b-256 52e9d5f575942c98352101122733b839e66eca292738301f75f79cedca78199f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406181718113029-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e5c81e28fa5e370546b9e7bb1694dfb6280ca32fe11ce1a10ed7c415bd6c262a
MD5 58c1fb32bd76497f81f4f1375eacd81a
BLAKE2b-256 586035efe09f2d7556738e4bd09639f6d8409e6019a0aca0552cddc144c711d2

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