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

Uploaded CPython 3.13 Windows x86-64

pyAgrum_nightly-1.17.0.dev202410211729248609-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202410211729248609-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.0.dev202410211729248609-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.17.0.dev202410211729248609-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202410211729248609-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.0.dev202410211729248609-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.17.0.dev202410211729248609-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202410211729248609-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.0.dev202410211729248609-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.17.0.dev202410211729248609-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202410211729248609-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.0.dev202410211729248609-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410211729248609-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d8790270a6e0d1159d2ebc312a0ae022fc8e858e9967f9f83e5a2dad8e3ddd9b
MD5 85af722c959d7aa30f2d244b64c7460e
BLAKE2b-256 4249cc511c58812454fc91875337dc6410cc29930379476b5c4da7b2d2be4c3d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410211729248609-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410211729248609-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 842284cd1e1fe3e2754163365ecdc21c8bdfced3cc909a47ead599c2250af89f
MD5 aa81bc0779773b90dac7122a604d5b90
BLAKE2b-256 add9398542f335a60e4eca6b61863bcb8bdbb432a619183a669af756fbeacd86

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410211729248609-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410211729248609-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 34aa74b4a2c22d2cb54847738d14b9694bf47bbb4a463fa27506e1f85e21e196
MD5 8c893402323c48b250a549de58588634
BLAKE2b-256 0fafcfbc2c331a63be9a1917c7ddade03c1d212a86d41c45a97478208ec86258

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410211729248609-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410211729248609-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 056a3602fe9f764430b9f9f6cb79e8c8d51e7cfbf74de422e22f17f55acc80ce
MD5 e3a0e1a77eadd641456cd9834047b00c
BLAKE2b-256 671c05a468da49a07b39c0016b5f653e7ce40ae03cc4c256ae1a7c7069ae6ddf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410211729248609-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410211729248609-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 d7008f5931e01ec90dc15ca600a50215f9ca3ff3e5286819849ff8ea0d42db23
MD5 b24c92236f4442f897e34f4815beca3e
BLAKE2b-256 80ccc5cafa43d4008d2aaf096531a8d471116d7dbb680810baeb7d54f6fa504d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410211729248609-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410211729248609-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 502167abe64a0a719faaf7d69ab45a37797c6f497df9e6687c0a776f70102317
MD5 9848e5b3e933468567fb255353aec76a
BLAKE2b-256 10a1413e597923d381810b2c8aa4386f5f26e73346193da9f48aa7daf3502f39

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410211729248609-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410211729248609-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ec93836a257cca6bdca57e372152355fdb9bf6c1b115c82d3f96e3574feb0712
MD5 d8e8ff3d43631552814ff946ba4c2ddc
BLAKE2b-256 4dce40dc712ac8f534a5bc3317799d5de446137faac7f46f488415f96308898c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410211729248609-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410211729248609-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 28015a800253830a36b9b7c68b663c91828a3f465e40a1910085bd1ed0626450
MD5 67f1b70a1157ec1a82c7c1fd78ceea82
BLAKE2b-256 d4ccd264e2a73188a022657934342bc5b97a600062fcc435c7771438779ca104

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410211729248609-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410211729248609-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1eec108e973d7a67cf02d85749333407d93cc9aa834c2c216aabf9c6c8634c42
MD5 1ddaccf4fc7f7cdd2f0eb7d8689fb445
BLAKE2b-256 96a7af437e70ebf8a1065a6a66a0472aba73f950275a5279182cda03b2bf638c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410211729248609-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410211729248609-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a590d4ac4d4a638df781f3cb025120103e9eae7b5939b6ced8aaeb94ee479c6f
MD5 919cccb85f9f901f23cac1d093f8d481
BLAKE2b-256 17f157cbc4f6b29aa2be5abc7a838f62fa72bd1ce5ce8ed225b8b1fa0d7b8cf6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410211729248609-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410211729248609-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 9b17b8ae23ef535d20acd11875665b41e0c0b00c1910d0d75c7c1642771e1e90
MD5 1011d2810bb224a1130770c4289e54c2
BLAKE2b-256 fd5adf6d1dc904c851d6204e0f1f792002fcd9a8c477135b2a1355565420e414

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410211729248609-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410211729248609-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4640f27db12a3e78b8baf01459fdb1b983f1754a3e6286ed15fb04d0e1c0a446
MD5 ae421e8b0feb4c50fa51bbd14fad086e
BLAKE2b-256 265e3399cb4191c02b899860b682b98393883e4bcad4794557951471d0215781

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410211729248609-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410211729248609-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 21d8ad1f42ff3faf94d7da676b8199da5e13c34f52bf68a54fb92ec4cd336f77
MD5 74ea5bbb08a4cced43bc102a2aa6c8aa
BLAKE2b-256 2ebd789d9ac0bf5215728b334973d209701360fb5bb923597a6a8767eeaf04b8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410211729248609-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410211729248609-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 79bce56e2aef26c6ab45a4fa4ad07f41b5d82bd8a44f9edf4ed769264f4c36e4
MD5 6b6d76e02f1900cf5129ea8e72dbce55
BLAKE2b-256 d1dc53e4173bf5c51022838a4707996e5d72d3542569c6107a03f833af65a1e5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410211729248609-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410211729248609-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 234385355a5614ffd2eced8a4f954f044aa5a2d1731800fffb9c320c43deb846
MD5 eebd3788099f66d2b240f742e8494d10
BLAKE2b-256 22df6275d1b67d481b245ea96f6daf90075187c2ac08172a0a7a0828f1ff3b4b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410211729248609-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410211729248609-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 af85eb3452919a002129fffe4334709f2484fc1842b733062a3aada1bc9a22bc
MD5 bdb5c7d6e8fa2ba4109d91f602a27fed
BLAKE2b-256 e3f64da8d98f4c4768609d7c7f31622c55600607f221b4fe0b28a82279690152

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410211729248609-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410211729248609-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e216bb69ffa54815188f326bae30150029a62ee84314cb7003d6f5f31fb66012
MD5 2a196f0a047f21327056f4e8a7a3a8d5
BLAKE2b-256 e22c8fdd703aa255142257dff571e381e4b18a9722706d7e6840fc279f0c0a8f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410211729248609-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410211729248609-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7a62c145a27f1d7ce64886d703e57b61e5c6a33c85a616500f0dca0327be0bcd
MD5 2f12a523b95462ee3f49c0fda293be9f
BLAKE2b-256 3fe2cfa9bbb04ab2b72f19109e5f831ee456d9be49e1dc3d7a65bd39052a47cf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410211729248609-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410211729248609-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 55011c94315eb0c38ae9c93a04886faccd5141f6f2b5c24844ad6fb75057c873
MD5 adc3dc7708aa059ab407c08cae1e609c
BLAKE2b-256 c688796b8a94ba15247f0d8ff145d24e6944872e6d55b4bf46a869db9981a8db

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410211729248609-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410211729248609-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 53b60c615b9627999b94410240cb1aca2dfd65a72e5453e83c56e0981d2abbd3
MD5 67f7864106b2cdd907923636a30053ec
BLAKE2b-256 fd5614786689b6d6444313e07854e19db941120a174cc2899a2d1dcfff898df2

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