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

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp313-cp313-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp313-cp313-macosx_10_13_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp312-cp312-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp312-cp312-macosx_10_9_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp311-cp311-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp311-cp311-macosx_10_9_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp310-cp310-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp310-cp310-macosx_10_13_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.10macOS 10.13+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 798a73060de187923121efed2005bacd4b9ab3ea23f67038ae305aa5d61d504b
MD5 c2ff2aa273185926d3b1c84bf59237c5
BLAKE2b-256 b6c46fa3676e83b40f47b3b80e38a3781630548cfe109e8c94e0e248549046e3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 10327f8a5778b70c64b9a5ee6b13981e573ae174d79606820fcb7c056a490a71
MD5 afc4805d57d5e9007896c557af77c904
BLAKE2b-256 96a1afe3fb07055f397e6f18d7e77aca6d644fc473d4da99fae290a23f388526

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4f398a2ece3b40d30351a4234809441ab64d0252498101e6088eb34a4cf86383
MD5 928e93b9b3af3082f5bc3639b3b0a12e
BLAKE2b-256 e78b6563f9a5dcb9c8282684e21dec9203364aada4db1680538f02e66d79c674

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3d0184eaf297f0183c43843b8e48aed8de4b9359f7a809e5b116eb3712151e14
MD5 b37f07b962989d0230c8d9881024c172
BLAKE2b-256 0a4fc0a1e6a88aee8f1c643084ce827a2a7c6418aaa31e08d2138fc423d349e5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 70a43540df270645b22faf0556626adcf1a7caf2fc67c9645da2874acb827612
MD5 04283c1e3c46512e433f7512dcd61305
BLAKE2b-256 e343588b42b915b25189051e76913110a7475677fd5f48e338550b11e404a13c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 60eea80d988958dafb9c91d54ea8813e4ffb7d4262dd49f05caaed138bbfe6d8
MD5 eed3869bc04dcc7082b14422468aaaaf
BLAKE2b-256 e990ffdb4b3f411c96dbaedda66600b533ad2aab40d256a05c5be06c9c32a394

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7d379d0be8458af4e283f0922a33eee3e37f2bb5f8efc0f253a418a7ffb7d6f2
MD5 0be73b53e57dfef8fe4cff60a94d3114
BLAKE2b-256 0b63aa65d44c70e49ea0caa6c7be76870c67fcddcb47f4320e3a724908077509

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 db82dfc7fbcaf341090c1f1f186ac255923ed576f5a0ed7654147c033d9a88e5
MD5 dff416c09ef4da01416562f32cf9112b
BLAKE2b-256 93db3d3ba679d0b94b12307a3b9bbe7e1cc4d33ed4424e96257bbb654342fcf9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 29e77b1468d6edd394e98f179dfe87fdfdf32923ff15b025be81f2c2fa7bdeaa
MD5 0feb39d0bbb9a18e7a4fb4bff61415c6
BLAKE2b-256 4c234595d2bd6049cb9400ab38740fe473e020dde47668c51561f7e06e18853f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5ea2d9041cda45c0a9713074b02ff541ed00a4749f24d8efe12af4078d556719
MD5 48c24808b77fb03644cdd86b631db6da
BLAKE2b-256 bf67604bd597803fbc80ba6014026d63c0944376bc57423d2b6c5d81540c66e6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5f0a12a19f0a4cfef872f740ab200175e10cd9b88976466c0fdad12e252e9872
MD5 5d54787d6e2b94c180427aefdd46c1ea
BLAKE2b-256 4a908a60e685868fac2af6c596e43be6dd37427187c536b4d0b18c30862893cc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a9d054414287200456f4beaf8f4b8d456e60cb7e303fcb649c975ffb116d453b
MD5 a09f12b7235a5a60d8054b070016b3e8
BLAKE2b-256 513b76a77d36c0083c230a71c68891923d2027775dce669db6bde18e114b0c91

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7696f023186ecf90db3fd462bfd335b9d98e5ade34120e74482b2ad9f1dc724d
MD5 a57bd5450126fe4d127d64987ecde72d
BLAKE2b-256 e5fc77b11d2c9e2ace80185b12baef89ab6bb9c8ac9b64fe52da678a7dedd634

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a60f6b53bf820a74ba9e5968e1b6ceee0f31109e553c059fb325d80790b54850
MD5 c8ca7c5d9cae36e498f2d22da6cd73b7
BLAKE2b-256 d3be259efd41637d6c798612d9b9d8470d7dd4181cfb0702d1249e2abb94039c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a15438727aa89fb5dd7b4626b3f943906c82c25c26a066c79c00a2da7b7eeb00
MD5 faea5492bc39e57cc6b4e187f4b624e9
BLAKE2b-256 919bc844f660a9560540f523a7eabde50efce7286bc3a5c6f56856b610e51d31

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 72d737aa7cf3935e45f092f9c4ccb6e9a62c61dc50b2321c176719f42ceb2b63
MD5 91741eb69571f4a42f0e98cb356a094d
BLAKE2b-256 aee42e3f394c6708328b35b86a4354c6acade56dec6b72ad8155863bfdcb86e1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 65d69be8df8f3fdcfa15786b099e9323add4e73f47aa58ffe1d71ecf8968cfa3
MD5 985821ac7938670c09067326ae4b4cf6
BLAKE2b-256 055b8a72f67c22af1336bf7cd3ff8080388c2cb301d3de932e600317a05c1f65

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 dec6e566983e84ed33d03a8931fcc30e20dcadfd6b53d44f5037c2e19964be08
MD5 da8850309415f1a2528e371db6fa50fc
BLAKE2b-256 5f7f36f8d10499b6d4b47eeaebc0306cc7aaa746e0e778b74c2fe08c2306ecc9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 48579b5a8a7953133ee1c6e3628a8623369954f9afe899e48509702f14a075d3
MD5 016c15126b0634a9cc4c6a1586bb904e
BLAKE2b-256 4c3c8e8eab94d09346235068fa112c6db7abe6dedb1825cabbde130e1e39cd65

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp310-cp310-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503201739452835-cp310-cp310-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 d6ec7a67c69a82649728c1e26f715cfea03921a8c54de37bc0ec6df296b3d0c3
MD5 79b3df89cd2ce7d4c2a5fbedbb277558
BLAKE2b-256 7fc2746a51e7d93108b3ee028e51d2985630ed80bcecb72e32a40e8948f6fcb3

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