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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412281731932516-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.dev202412281731932516-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412281731932516-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.dev202412281731932516-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412281731932516-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.dev202412281731932516-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412281731932516-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.dev202412281731932516-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412281731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 93108e93bab1777234a46dbaf471d6c90057e3d4e23d2c7eaaf87485f941b9cf
MD5 12d238296483234b0a39cc76a4f869f5
BLAKE2b-256 0709f38e7e47a3d36f014e257fedf42e47fa9983180137de580d6dcd99d13396

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412281731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f06d7ab3e51152ec27a69918dcff097c905068d96ee764cffe8d178412358833
MD5 ce71953bc25f94d97bc9a6d308c669f2
BLAKE2b-256 9dcbf61e49cec7cb64ede49a41ea11cb0f4d98eb872a1bd20caac0b09fc551dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412281731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8ec827ccd43af2a0874ee8a93dbd34f2ff43ef0e4604b3cab5d50562dc86277f
MD5 4cd81754014b2a1379cb5149a32fe17e
BLAKE2b-256 eb24e47738ccffa356d77e0e1cda0829c3c7a2c30e075502cf3dfcf48597228d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412281731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e71b7a0c239a39bb47db409a32a5806cd7b77c91e81528ebda5ea895a181dd11
MD5 0d5883d2c2d81c8900fc73774e76b651
BLAKE2b-256 b910faa77fb90821fda2a6494d86f4a80d25c0446ebcac8009e3c84140d62656

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412281731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 b153bd9b40fc3e6bc88b5862c7651bc8291d71d6c9722852e2118724c5741b58
MD5 343574b101e94a876833c2596f91b6a5
BLAKE2b-256 9ef8116459c55bfce4679f5cca6d599b8e9187e515fe02af973c772baa9e4805

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412281731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 69c2f6f1ec442050edc37d6bdfeebe9452d6cb6a08f60e14ba78745fcd9714d4
MD5 cdea78219b9676b72c03ac1e0334c8f3
BLAKE2b-256 8b24e7337b2a1491fc6b0d9401c2605c2a9cc754f66ccc806630aeda9513bee3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412281731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7377510f251f744e0fc13ed72729338da9181ddc0a088bc00f92b8214c65e348
MD5 aaade016d93ee295a25e34108be0eace
BLAKE2b-256 f5f40fd4e293d5e74b5ebc0a8771ac5e454d88f9d92fa3898118d9e1efa86ee2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412281731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d452d1bd88d285c7e0cedbf1db6ecc26e7965bf09a3c17b0e120d4276361392d
MD5 2e12a683b2a9f7b0a03dcd047458f952
BLAKE2b-256 38e294aec15cf7d530c4ede049ca8674f3e48093ee91385faa42217a6fd70a84

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412281731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f1be093695583ecf8a1dcb4615f907634ceefd011ae1f373fa3e09d3d6f3b133
MD5 5036ec74820e5eaf2604cc647f351673
BLAKE2b-256 9f2ce4aeaf1e7fe3bd77c56096e34acabbef558fd68455449cd8dbe88d51382f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412281731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 46abcd74407a628e43dff4c7ff5e9523d4bde2e2a5ac86389356700a5241bb76
MD5 8b941354a5d1a954528a9d14d7423e30
BLAKE2b-256 8318dd19133ae140e6a4c1b5dbd54c3d13c6ead46cb36e1f702ac23581135ae1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412281731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c91a52a938151e65dd0064906bdc1daff580986ef1651a1f192e232bd77e7505
MD5 c138e88ecbfc6e2e9980d65b03b12eed
BLAKE2b-256 911ec33fb609bb1a1c5f2359dc16bdda995d7094cace42b7635be903ca489d54

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412281731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8d35a3dee19498efa72299c65246603fe550775ca227a972ed30556d2e86d3bd
MD5 8a3548f4cef4698e668c06fc1dc01d6b
BLAKE2b-256 0cdf8ad6d3e463446a14010043783fe2b418449a61094da597bad7e6e2ce0718

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412281731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 46cb002d00bd8af5b35c0e3690b5ce693c9b3b15d27bfbd209fa3807a04a3299
MD5 7801b7d6b4ed44fe8fd0e6fc4fe8af4b
BLAKE2b-256 c3e30d67383a0cc49e72d69814a0dcdf1eb7bb905bb712a5bca368c3021c7f14

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412281731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 811176f5cf8443e10abb79b0f350bddd667222efc06e19410b1ad19496687520
MD5 258be81513fad0a79838ca892ee00035
BLAKE2b-256 253bf3f422f2a154e1fa71a60d5a8373a36edc6824eb666e87505b20376e4c9e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412281731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 301c6b647343e1c6ebad3562c3b3ef0d8193feecfd78f4522783feb15762e272
MD5 7fc9d79ae837bc689d3a2eec68be15eb
BLAKE2b-256 dd998bc733c2304f3a81ef3de2b7d0aa8fece9e2cfa1b33096ff115b8788e7b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412281731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b1f17c1aa0afc03d0a3edec42d1514310599a85f854e7906f153b36f4a837c4d
MD5 6f199c9ddddf433d3c989b6d074a3c6e
BLAKE2b-256 615c2f6a27b9c4c3a01870bcbd6e37e438df46397b58f428682790268718336e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412281731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a1a6efeebbe2877ce8e1363c63910f55f44052d64c74d058f360f75562153349
MD5 705d1dcecd66eaaff9c16e832afbc4ae
BLAKE2b-256 85c319d02c1c81cd5efdf253e4b2ed8ba249c0e6b45d212a8989bf0d09faab9f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412281731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2363a0db57f932acce1ae856cd3fdfb5ebe65f7fb525ddc07d483aa4dd440191
MD5 9937b55e249b569acb6f878e7247bb92
BLAKE2b-256 a522ac4743839ce416bbd7645f55470e9e58d68512223482c4f37d3ef39991f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412281731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d43d5965711d2692dca24713f8647096308c1a865a4bba438492ac0c4297bf20
MD5 f94e330f822fd724c046d61877625711
BLAKE2b-256 45d7b60ecf099eeaea651a52660111e92af222b7391c24149db91f345cbbb29b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412281731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a8eb05078196aa4930a3b3a94b4106e47f556b65342e305c91a45dae04d663a3
MD5 ec5a9659ba2d8bc71990cb9a1eac7319
BLAKE2b-256 ce24046718948005d07fa8748432012d746dd49bea279e7fb7c21d0b0abe996d

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