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

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.2.dev202412041731932516-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412041731932516-cp313-cp313-macosx_10_13_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pyAgrum_nightly-1.17.2.dev202412041731932516-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.2.dev202412041731932516-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412041731932516-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.dev202412041731932516-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.2.dev202412041731932516-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412041731932516-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.dev202412041731932516-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.dev202412041731932516-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412041731932516-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412041731932516-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412041731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b358cd633f3d90d0e8536635ca546583c68e2edfdf89fc9ebc89031a318499d5
MD5 a28054db8eb29a48a79011e9424ab4d2
BLAKE2b-256 20bd2dda65fe5ffd636f9fc2e155d578da0fdddc2709718060cd0c51bdac9b24

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412041731932516-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412041731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8b09f8eb98aace4ab7eb7525683097c883c78c17a1e560d11a5154688387cd80
MD5 09f19df9878d9ebeb0f4ccb7eb14d15d
BLAKE2b-256 e3becdcef244a42f81298716c9d3ea2eb847fdbfe42a6c999768ad0bf6221174

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412041731932516-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412041731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c68af6ec91c2006ce371b9375052f13492c61ade6ebc66ee2ea64b76d92c3978
MD5 12167abe0f4730215838ea3b79547c13
BLAKE2b-256 923755df8b89961057e1aae8dfc9725f23a00e6f5b01d6a05201db631fc31015

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412041731932516-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412041731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9ca8e5a73c5a18416d0a9d4b063efa1fef9fbb8ab1db06c46caf27a2e38affff
MD5 b429916b487c14de6a01255fff736a56
BLAKE2b-256 233d1d7e038c6de2bf52689e531625afbe05ec74b748f218958d41b76eec3924

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412041731932516-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412041731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 74b53eee663136cf7a44c498eb48130fb7d02311e5e9166f1785763b5a656c66
MD5 4e8fef97020c329073e0e49690a2cca2
BLAKE2b-256 194110b4d23fea293b467e11aa6d955ff998f8518f71c95307c2b6a146d34e2b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412041731932516-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412041731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ca05f5c8d6abff9ef1b4f775d328b4504c5651148c1e22b87f75b72c01d82616
MD5 78303d1f9ac7385a00edc3d157d2d843
BLAKE2b-256 8fd7e94ad6cb2c5fd933fc20f8b011aa1676b276df80e97088dc2fae57351eab

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412041731932516-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412041731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4aec2614cf328c01b8857dd458c0efacba97d4f5aad60d278a648b8f3c0a071a
MD5 34572fda37b8588a66a0a6101c00e0cc
BLAKE2b-256 24c6777b80c1cd9b4d1052ae26103200915f81c6f9f8a3db63c907db6f186cb1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412041731932516-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412041731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4237befb92876e5e31709b8751f4401349a8c6c3a6dfbec683675269816ca30c
MD5 3cb4c9873c9a0ef382ddeb8b186e51fa
BLAKE2b-256 07ce53a31247a2fba79d7aff10047e58aa183cd1e6a16e7f4c00954e4ae2b82b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412041731932516-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412041731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e70b3348fe72b08e48b103c357cbb339044149adcada5e8c95bd5e8aa6f99924
MD5 52139349fe7749b01da3add5108f901b
BLAKE2b-256 3ec3843a37f6ca68082648d3887767fd7af539b4ccb723b404c4d3e4c8020177

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412041731932516-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412041731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 05c6cac89e968d4ba76bcf4cc9fb2820152aec099bb78c9cf951be5a25639319
MD5 2e5c793f6d129d9830ce21a00606bd70
BLAKE2b-256 333eeeffbcb054829b6959958297efc9e63e19ee46435c6a36ec5cc767b08f3b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412041731932516-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412041731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 0d6acd8b65c74ddec9bcb08800b31d91986e34e2040090130d16a6c2cc6263a8
MD5 447bf561538c818b0ba43938cda73cd2
BLAKE2b-256 e9790b550759b55a1d3d3405ded166f0f68432b8d1a079fc9cd6672ea236acc0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412041731932516-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412041731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0ddd368deca0832f4755121fe335fbe52dfe05ed0114958f581c65acfe5fe71a
MD5 1902214e828b5105e0b00757511b3b49
BLAKE2b-256 a27c5aca07fa74271f304fe5ff290f60e7cfeba422122fff2ec6f2e4dbe6666e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412041731932516-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412041731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6f2348121393baf3567c96dbaccb86275ce037f97f98985d281cd72a1582fc65
MD5 3e02cfc6287af20ff07b010cfa417b46
BLAKE2b-256 35533991f0dbc7bc31784821f4b88b9c9f2907d6b678faa0da750e513d5e233e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412041731932516-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412041731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0d6bef31f3b24a07a02ac8a41f2a3129902fa256ec3df83ab7c8c3b876b3fb66
MD5 a99792d70f87e00cf2ebb888b5c6736b
BLAKE2b-256 7012db76ff4587355d84af38778187564035a3b25021fad9a5c32a302e9db837

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412041731932516-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412041731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8111d018f41088a53e0324fb416ad0df3508cb1cb5df557d140c11f325b8c819
MD5 a8cd91dd39e8d9e40784bb89fe05ae98
BLAKE2b-256 6c389e50200822b8ef10de78da0cf3b17066c38ad78c2658b5048819e59acf0e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412041731932516-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412041731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a110f914adcfa822ff58d4b382dd2561cb76490ef73da3caa52e75a3deea0db2
MD5 4100e1172ff6fe1deead35e8811c1048
BLAKE2b-256 da191af077aadfb4d85c58ba3e3c46bc3a21942f2e71a4eb106af411f81c662f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412041731932516-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412041731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a15d7e9b2a60f40a70da1a2809dfccd69a9d6e584cbfcaa2f30872f171c3c9a1
MD5 80160d93de1d09b0ae970e107280aa40
BLAKE2b-256 37e670ac78958c4f2921a7ff5db22f4e13b989324f515ce9887f0707b32c91eb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412041731932516-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412041731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d95215a3b6d732fdf0a5fbf0790dd5c5ca6dcd6ded08210d64eb09c69715de2a
MD5 47dab34cd28a42966af91d5889e73a25
BLAKE2b-256 a317fc0729e32e4e84208d8022e9cdf8759d65cfb181c06bba3e7b32c453d76a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412041731932516-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412041731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ab1b0969568e4f87a99dce5f3aa3bd71fd126e0c659c843a83bd768aa6ca0322
MD5 a3b10cc1a7e1fb063af669af5954e2f4
BLAKE2b-256 aa283814ad2aae9a5a2485807f9121d178d852b42a5862fdae8e243b296f3b9b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412041731932516-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412041731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9ed6c6a3569e8d61b5bae30f5a92c9ef771ac2da80de6a01afc2c6ddfa8d93f6
MD5 46846fe1e347ead7c7a6f8cb449c5ee8
BLAKE2b-256 d404a8ffda18fb1d379975bacd8b0278dba68c6a7aade8336c98629adbfdf20e

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