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.15.0.9.dev202408121721169663-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp39-cp39-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp39-cp39-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 29d10728cd0fd1cbb4032153c135eae3a4aafe273a67b3673cd5214759324687
MD5 ba64d23fdeebad09443c4a4dedb51e9c
BLAKE2b-256 4a0f0fd4967ee700a4bba6e274990d4722d2a93464576c87e0280fcefd20a268

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c0681c410a71e916352df94a7c12d54a83685576df4e87357a777eebff2be199
MD5 062c2d906f44867f307c84c01fbd0eaa
BLAKE2b-256 44328fbbc7af86fbd08ddf52bce5e0b0def6d578d22ef986da01d67481065842

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e77a8e48819489bde7e2976b28e5d64f78695301581c6d335c80b1f87557cb52
MD5 b5f982805ce00064c93c58c2762987cf
BLAKE2b-256 6c6de4f041274d3179b5c76df56355b1a2e2c28ce105a23bf5c6f36e89555d18

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 da685d85d1561edba99d7c5e0766e21794d1aae6b245a57bfd2bd886e0aa92dd
MD5 1b6c78140c08a14e32a3786308b87288
BLAKE2b-256 cbb3e81bd9477e12ed7264c55d054ef610b0023ab04bf14f5763d5488df17421

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 39e10557c77c4158944b9daf76e0bd720a4fe4ee51f44896b18f1c9bf8439787
MD5 4280faaa3a1bb4e6902e3c78ac6c3dfd
BLAKE2b-256 09d6c6f762b31742d814642a0191e411f758494f93b791a3d857463fded4e709

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 6f5322dab0246e9d136bed7ae4ffe7efe43b17e0a988b583c01e7c8099bd3979
MD5 9d6ccbae477ebdc4ba65b877ca65e59f
BLAKE2b-256 4f5febf9bafdf7e7f85db743aadecca740f46be57bf3fb10584f66909ba30fed

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a53c63454fe7f7fdaf9c933543e1638e9ab242301f942ab5216217fc92534e3b
MD5 b0030472aca8e64745458cd559ea4358
BLAKE2b-256 c71b6217b8ee058d82f0ec8d31cd1ec7f7843707cb79ebbcd25d4b160115bc13

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 faa69320d810dd1ea40c9d66e70619c36e34b2fa94230ef63572e54fa4d33753
MD5 f166650aa44f95f9bfc403239eb8cae8
BLAKE2b-256 3419708d08579e68d8c658d1f5f275348d3d98d31f040203c55d0d79fa2fd3a8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 006d1b4a2b8ec52101b3d8ce444a516ddb85c3e8240fd81563c564c4adb89c58
MD5 5781a4983b4e74e3653c61d6c42c1771
BLAKE2b-256 ed9936ade695a8cf18062e7407e5e9a39f5c02faa75de242d1dae029d70c308d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e3ded5d5c90fbac20032eb482b08d36744859a57bec509c99ce8022c82c7984d
MD5 c69a0c2465680e05565941492a8fc929
BLAKE2b-256 7fbb003e708d4aab35c30b7c9d7d51e3f30fd6c14f06533da47f6ff40b45572c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 02508dd984aeb43da9c53b6edba3272614fb8379fa15f8e5887e50e072453042
MD5 ae236a89abf2e8e139651f13975389e8
BLAKE2b-256 f5dcfd5c4384bae95059531fce1768dfeebd28f5df997a7d3cc4fd396c2d8054

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ff9d908807fb40cb2486e65ddb800f9997c5d9f5a17edaacb8b17c400b5e7082
MD5 346c4ded39503aebf308ce852816c282
BLAKE2b-256 a50fa8540bd1db8d9eb5bf1e2785592a99621264370b5f8364a5a7fcb788735b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d5aec2daaaa6e35346c803207e0192170c10ad1dc93983282b938b1e699a9225
MD5 2c21120cf604298050d9724fb95fb28b
BLAKE2b-256 1c75aa4f98891f2d5a2e4e74ed117055582a8231b0e6111956fd92817af91b9c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 317ccae26c4c6206109287a694cc6bf8fa0b833b81abac50a23d698b37332c7a
MD5 b58d41ad18fb54b7ae7d35161f7d5399
BLAKE2b-256 c7dec2b835fbc37f9113091aa36ef1a175f3192a7737856c6d7658724410ca4d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ff47124dc043f6c00a7895cbad987a670538d8e07ae7bd093cc6d8420e7f301c
MD5 5afeca68dd5b70df6e6a5046fe484623
BLAKE2b-256 dba2ff5e8272e743b9663b41675cf535f349a1cfae8d09287e1ddbbbd60e9f12

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 cf4dc6f0efed5554640176d945335a297bde316ad563b19552624e9249d24452
MD5 19ef4658c45756ba963007660be8d710
BLAKE2b-256 1daff0595dcd35eaee88a06ebead52757b4706ba31b94fda069af76e6ca2cba6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d63bbe920abddec245acf0c46690c03282d9f6131fa460dd16dcf2c1f430c356
MD5 673c5c9446851bf05c828feca7f65e0f
BLAKE2b-256 e56354f5f8fc2afd68d3fa94ba60739716cb5e2b37ab4a6a894436447d4e6c08

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c63cd6b71cad683088c3233fb444689dd7adfd4fcf5a25374456f05204e8ed1b
MD5 8c86a449222f5c973c7b37dd303233f6
BLAKE2b-256 0bbf24eeab12059d2a7ca89c8a5cf4bf4a7dc70b0b8fc313115348e59fd8e41b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1ce3f7fab04199c8b203d4d4acc9bd1271e36862ed1fea9d0d21348ddc61f24d
MD5 9872df43f41d5658083c7d9c0f82a5ac
BLAKE2b-256 0960da41fc31f2914716390e1c065edf4ae58287342de8d1a96d5c39e470c6ad

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408121721169663-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 aaf65c410f7c188bae590acb8f02edd33cfbb356d6bcc229c64cb73ed2f679cc
MD5 3cf7e67d0a1d63bd878e1af1dc1509fd
BLAKE2b-256 1dddc36f20ec4c701e58c95e594666375d22efb7ebae93313131c5813f4489b6

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