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

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407031719384100-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.14.1.9.dev202407031719384100-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 61b2854cf608a7b6404bbcd15f4d063b723ca3ad8effb263bc851afce3f2273d
MD5 7c8910b89bebb0e87066a5c7de3f70f8
BLAKE2b-256 0d2e6ac21b91f6ef371895cab60403ba3caaa3de454c853d482bea639274c0ac

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 755b322978c37d187e380086c4f3190fa3f57ede34b34a9113b920c0a0f50f28
MD5 0acf9e3bf6060b515c90f058f37b92e8
BLAKE2b-256 60ba4aeabe29cc580944a93285c1040a870a9efa2491d04d9fc9a4b7a627d3f3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8572af955058dea52f4ac3e4e5469997158252bead5719db74e153043eeb1dce
MD5 2aec13b7a9cfaebcf5512d4a25dc8c3d
BLAKE2b-256 8c9523417e1edcc27f8bd6f32436b0b432d4715952a3ecf3c6223d96eb2e1bcc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8d755029ea00288170ae5f1b33bc5339534f7ca382696a259364f64b6805952a
MD5 8d614b2a6c69c3b0f9ce9f2e618f79ff
BLAKE2b-256 b84f016b6e0214e5978a4f9ad3d2b2358ea0c9f809e66e55e4263edeea0b4f39

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b1b1bf88386a56e8bad5a604748fc01a621cd8c90a54312c10583d95924cdd96
MD5 bf66b248eb6a4e8505491a878155a631
BLAKE2b-256 0b0c304968c10cfcb3e26eb1e1066587e89a5bb02a66d7db17aca335530efecc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 4b8ddda8a06681901a57237dbcb6ad90c56b1e7491d58af6b3e67ecc90ba50bf
MD5 dc8c2631e1639bda784e610590e117f9
BLAKE2b-256 1821b5ab3934e8989e502c1256580e9e8165c6efc2a46e5a8804729a28984a5d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5a6f7220500ad8a80c549c775e88e2ba4ced7c2b06e808b62b1046e901a4a3ac
MD5 a7e7e2b1aa8efc11bb00e5b2ebce86ac
BLAKE2b-256 2d5b3a0d4e67e0a43a80be9afc9df15445a762c41a2ca3a39e5e864f97d70da6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4f2e20274816413c1e80b4cec4aee3aa0d492e38b85ddd0ca021dbf09dff531e
MD5 923acb6838334880e64856fc507067c8
BLAKE2b-256 31dc68724117e0f6e6139c46653071fd666b8a860ee3c3344f84596a3c7ba39f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c41157fcd09e2f18f7e12063c7ae71f03bc8b86154f98f8612dc47f4dc0664fc
MD5 0495971fb02bb18661fea37d212101ef
BLAKE2b-256 b943878f7997dd597d5b578f4c45c05533d4e0b870b9a52d6430345cfa9d7ce3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b28e3b8fdbd087958a5af0a3b1ff47b02e4e110342d7ece5282c90465597ca4d
MD5 c0f4f7a943545ec7e74a87e5a2dbaecf
BLAKE2b-256 761ac535a51c917a2ce7ad942817bf7a7e68ec7db2894e659291465709c2b97e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4a23e6dd509704cdf5c5845b5b5e1827dfdbb063960bfc2125b0e6b4de60e041
MD5 e53055a42b9670ad0ab0e07300ba82d5
BLAKE2b-256 b68398e209faf8b9732e4bc0dbae15af5babe3c409f113723f206ef79a8f4cd5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6d3d4f06be4ec3538d6bb528ef8917fda65e01986d1604fd4b6e6bf26fb17065
MD5 fc3ed5d82d1ec3b81bff7a9a5e34875e
BLAKE2b-256 a738ef0e78572f02045da334cb6d9f1a94e96291242269eddd61490e22aaa33a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7a7a26881cc296ecae595c85528dbccb9a848d62d723d61424fc5660986d462d
MD5 d24cfcf16cb55768f4281029a8f9c3ff
BLAKE2b-256 a01c0a9af42f5e3e73e0fe84c1793965c98288bf60805d6313bd5ee531cbd9c2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5822fe602073d466dc13a67b54d0bc0f3615d67389a2324108edc1e4213ec699
MD5 08187d5bc4549383044ca6cfaa9a2348
BLAKE2b-256 5595e91a84f083b04c22be92418235023a48d73f4ef29058acf26dfcc96b8354

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4e0281af9acb43d5d3e3c5f49b8bd7f3ed559d7d296af4370be983db87f3c942
MD5 f6bc5999f314bfe6eb93ab0e02712823
BLAKE2b-256 2a41c458fdafa34bfe35a892089a55ed375485b84cca100fca5e6df599b6d434

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 53a736c314dcc4b797faa5bb50ed84dc88a3f8ff19b387a0e8fb125104e0faf1
MD5 d9bce593379e8a9ec287ff97a01ceed6
BLAKE2b-256 9bb187ba6a149beeca2d32e7fa522f11e3e3d731a79fb1bfcfee3ab4a463ae86

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d69845d8c613688a6f76d7d6ae19055de899fba0b0b41541f8cdeb5e4bba1ef1
MD5 794553de39f9b99197c970f7f1b839ef
BLAKE2b-256 413dd2391096111ce9714f3e4e7ddfd69d7a2f2ee25bf923bd61fca482531b51

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 85423bf4a58cff520a93e699b818388118f4be1a6e397a9d87bc7ca8dc757ede
MD5 90264ff268938467cae85371b29436ad
BLAKE2b-256 327be2d1b44bbbf270b7d00005c8cfd179e02733da1d0952cfec54ca49cfb29d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 be9ab93a59d7048eb4a906ff4d9ffb4c265665d9dd22ba655ab94a776588f036
MD5 fb9203686c88800d3d6f2ba7591df303
BLAKE2b-256 b3964ac3e661e7787cfe3253eca42c3a0cd106b2a23f288409f21661dfc8aee2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407031719384100-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 88914090ba1ca4e8ca64f7f856c806de0d3c897d625c14459ffb0ef9997ed6d2
MD5 b2f2d8a95462e8afd5537ad3fd3f4a2a
BLAKE2b-256 c5a0a57a69ecb99b01ffe0fdf93e852148b09f89f5e7fdefae86b587329e91c0

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