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

Uploaded CPython 3.13 Windows x86-64

pyAgrum_nightly-1.17.1.dev202411101730930665-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411101730930665-cp313-cp313-macosx_10_13_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13 macOS 10.13+ x86-64

pyAgrum_nightly-1.17.1.dev202411101730930665-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.17.1.dev202411101730930665-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411101730930665-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.17.1.dev202411101730930665-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.17.1.dev202411101730930665-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411101730930665-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.17.1.dev202411101730930665-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.17.1.dev202411101730930665-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411101730930665-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411101730930665-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411101730930665-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 2302fff346387b93e98295d8f4b61c5305e3e2ea26c7675bfcbeb81216b34411
MD5 2123ca65d2fe707eb9a60810cdf3381b
BLAKE2b-256 754860705d83a49cfe042c2b0b4b9872d2ad6933cb501eb86563d43dbbc5b6a1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411101730930665-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411101730930665-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e7d2900813d5b7ca5d362efbcb466349eacdf5002998fcabef3fc1a455928390
MD5 b8a543db48c10faff81c00a9770faef0
BLAKE2b-256 49dee9efcaff70aa163bba6d51e04ad09435a6a25574a11aaf831617888565df

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411101730930665-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411101730930665-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 235f51901bb36a683ea8687ed1ca15552c6a8375bb40b97d0ddd23329e31d7b6
MD5 58f439cd3b11801c427c16ebbb4ff930
BLAKE2b-256 5e6f43974c16576240c55be5b171cfb0344ed95b48486206ae5fb44280dea3c3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411101730930665-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411101730930665-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7c47b15a1b0f26bd329d1bea662ce7322e0df1849f0d3e32f6e89bf1d75a6f59
MD5 6a05b722d71072818d360ba9ff13a4ef
BLAKE2b-256 90e328a7e64469d1d36c956746d8b6018a802261e2722550316165fbc8d41721

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411101730930665-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411101730930665-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 2ca329d3ad7fa3047cd14861c53f79ee4292d73d3e026c1c74363c978b5adfc8
MD5 ea8426950f9615dc2097095ca04ebe14
BLAKE2b-256 65c3b23b62813a7298669c5a1506cf008f8b60cccaa4902d0c15cc5a4e818e3b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411101730930665-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411101730930665-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 1a8c4937b1f2aca30d548a031ebc76c43f9c54215a8baeee0076c8d853bea0b8
MD5 4ea8c0333213a513aec4dcf2d9354bf3
BLAKE2b-256 0190cce268cb3fe457653da9d6912efdd532bc0bd76f4b923473f2f358a72287

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411101730930665-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411101730930665-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f899b0f4a986c6416d3b21a4f13695bbc1e2281c241f8c0fab0aa73fe5be0085
MD5 642e3376a83aefe7d5a7e804475620fc
BLAKE2b-256 8d5df602f36c3b65bec445de95122a75f45cfddaf54750e6280ce5fc8bd6a9bb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411101730930665-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411101730930665-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b81588aae30431ec03f638ebccdd6ffeea9097c765a01b9e169b41cf9c4e4655
MD5 7562296ed73e0a65db4dc69fbce1754a
BLAKE2b-256 6dfd07bd98be6564c9cd81488709b86256ee6b2d2688e4fe6cccf9c062a9f301

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411101730930665-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411101730930665-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9e41b8c4840f08b5bebafe43568779e831eddd95ca583d46958f8f523f3986c1
MD5 169a8391fd8ebe6d643738413e5a49cd
BLAKE2b-256 c293adaac2e0453c7e9e2f0c9af9097e40de40ee1ded9044be71ae5366c47d7c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411101730930665-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411101730930665-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 20dacd18990700a62906cfc682d63ecf10a564e21292189ba9be4d8cb94ba3c2
MD5 7273f2b8afc414c0f787f86b64f261f1
BLAKE2b-256 b78f7d86cc5502b80f059a3104396c437be57d39be8fcf5c617765ef168291c7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411101730930665-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411101730930665-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 65de2fabaa5f975f140c5e6af14bdb104249eda31f3c1d4637f84ec195424196
MD5 eb131b4acad0ce439234aa00d2dbfb36
BLAKE2b-256 acd26c0632e64d1f0d37f9913487ab8b550dcf54e0f2f798ff2c18717dded628

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411101730930665-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411101730930665-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f86b26f5c9ff5c6b1b01dd1f0fd2fa082e9204c1ddbf49632299e090cb1dcae4
MD5 e650a7df375463f117e35221df911ba2
BLAKE2b-256 27fae88fc09c720aff017923cab0a7baf4971cf9b9868ad0682bde361fa21e66

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411101730930665-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411101730930665-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 edb335ade466ac52e7825997c705fefa8c998e55bc153b76c52ac41e0e47704c
MD5 d098adebd173b76bf4de2a686ba3b8a4
BLAKE2b-256 5824d1f335ee2cc3f274d01975695981057bba88301877362cdc3e8be884b7b0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411101730930665-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411101730930665-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d2a082150c9d8e5939ee1e49cac1cfbd0cf6ca9de30332cd61ca7a591a247ead
MD5 78ba52de48838002f570c2b9c43e6329
BLAKE2b-256 0af9a0f4cad6ea376167e6a0b7bb615aa4b8dc8717087317774793edf510a2ae

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411101730930665-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411101730930665-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 fb9718f01c0d569f2b6d3c3a53d5a1aa0a11148f8425554e8712274eb93951d1
MD5 632e7c8e12be083d236e07e0cf23cc31
BLAKE2b-256 93092dba14cf1815553f29af36a63c36f94aa18852250780cda3e5b21752e071

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411101730930665-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411101730930665-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 9fa71485df23af6a5dbb2e24bf41853cf2a36323437ee2e13dafed7763afacf4
MD5 d1fc6aed22978a7ab7c5368511922730
BLAKE2b-256 156937b9a559620a4b72ef9e84fc7e9e6aa8e106560e49ec3984d10a4f6b8c4f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411101730930665-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411101730930665-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b5855ad87a3d163dd34e183cc299e2b7bef481c5784802f23b6be2dfe90b9b05
MD5 9a5cbe827646b0a1f4585238e94c01e7
BLAKE2b-256 398012d35c138ed2faa7eadf2c1a5e411df02c41f3293842b1da4c3eac331bea

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411101730930665-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411101730930665-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 475976860cc92d2babbd36537bbd0e3e41519ed35870cb5a057d04beec85a859
MD5 380857399497cd55b0f18eee551fbc94
BLAKE2b-256 1f2a2e3e7ad228b0ab76dab700337ddc5bbd4f61b79adb4142bc4b3ad28e71a2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411101730930665-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411101730930665-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 efb0e3252962e3f5935b797e8305482d51a5805f66cf778cfb26e5c66ee0f2ba
MD5 88b99225cdd07376f762ec84c558b84e
BLAKE2b-256 3f2d88f379bfd75df3fceeb4a76bff8f4b6adb8a444508a7fbe3b61f21d26281

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411101730930665-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411101730930665-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9934ae3882b03739083c9df67b26ba753a053e2a9cec065243872110bd872623
MD5 e98f13297d79aba86c230051ddf269e1
BLAKE2b-256 20c47d90697a8a74d0bfd46d2b4e829dfddd9291c6cbefa5c788b6cf43bd47f2

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