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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202503221739452835-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.dev202503221739452835-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.dev202503221739452835-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503221739452835-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 352c5b58ad3510baa20f86e4f3270fe606d72e428a3040a9539e024fad3ebb6c
MD5 9cc9ad1e788c0210293a4bd4f247d3d2
BLAKE2b-256 a9f5eb6af2b562811c40c88fbe9989173d28f631ffb6f29875779e282fc7af51

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503221739452835-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 435bc10d185cfd340921f878c186c21e484235782eb42ac64396b592127e9ba9
MD5 4432fa12128954f6e99f8098999ae664
BLAKE2b-256 64c701f0cef2cdd5edd9bc4b8ac231ce55307246d35c71af86ee0dfba37bb609

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503221739452835-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 99a94f2c5368fb3394a4872d0ee14de4f14cffd81757ac624873b835d17c199e
MD5 c43f91ec3e29ce3af83a505fe49280eb
BLAKE2b-256 be199f48220fec2494aedcd6794aded842a6122ddfb9446e91be29329e0a1344

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503221739452835-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8e844fb95adecfd00c6f04de4b573f6ae29e6a9cc0ee67916f2144042cdd9e13
MD5 ad4cf9df2825ebdad5e10f195ac8c498
BLAKE2b-256 d2de485ee6026a73fb39f32e0d7aac3266e3e8fc0d676c8f0501750024c1102a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503221739452835-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 4bdedbdd9e628d73bece60672f58971b322bc1ec7c8f387d967aed63500c297f
MD5 0750fe98ccca903bfcb38c1c7dda5c31
BLAKE2b-256 6c7cd5ce9745a9e500a69446b589d6a71a7d8ce3de44150b7b792ad75fb57cba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503221739452835-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a9c87f3b943711b6e4f4e6c07df8013c2de0f603fdeccb18a9f3393777ca1208
MD5 295de3416053b0500a52a23ceb5f765f
BLAKE2b-256 79ce403ee49210e8b324c59f7bcc7527f9d7c1886fb9a9eb4bcda7b8de286935

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503221739452835-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 525e3cd6145605a8f2580ef051ab5b1587fe559a99218fe2d4a5d95d6aa496c3
MD5 4efa1d83f68779a9945b77093d6ba05b
BLAKE2b-256 a1d802a9565d23342c09beceb82972076659859cb878b7f61441fb5ec8ec027f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503221739452835-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d985e6c176aa3106999601588a17196c877e3c06ae13503e6d1ca281ae35ba3a
MD5 4289738203e086cea89ba88e3c451e88
BLAKE2b-256 cda14d7cbff61b6e7ca1842cf08d766d3dca273cc1dc46188e099b7196fd767a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503221739452835-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fca21877edbd4edb2587821fac6667279c1700f622e15105503021cba1f0dc40
MD5 8a120a21d75ffa4de11a71d582746605
BLAKE2b-256 259c515ec9e950e7b88422cc30053b72dc16b01e1dfe3c47409b652c0e5cf51e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503221739452835-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a95bafa7caefb1ffd3bfff9c701c196351cf465fc1ca8625bfe5516918c1838f
MD5 570ab5341741d20585a96300f7404d43
BLAKE2b-256 7e060d03dff570b625ab96ba4b6a4c11401c489016570582cb0ef0fdff0486e9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503221739452835-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e5fa846c23a8ce27d429af82f8784e7a512e3a2e1b49b5f5d7aac04173c99034
MD5 9296cda633b80b6a1581728bc7ec9c5d
BLAKE2b-256 3662c0c6f90d1bc2b0e325d2f63e6ec4e8f8b571435350d6695205ec9a90a41d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503221739452835-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f5bb8603d362d880e1c20974999c006b5458a392f7af174d649155889c72d31d
MD5 748cafa14d2909ae079e8c0c34a86be5
BLAKE2b-256 fac7dec2e7ea16235a13092a834065f68f809988801c20b033eae2a4f25869d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503221739452835-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6e8a5b44583b45aeff2b3dd4c0db9099bf91c1483db762ce7628d7e9746b6637
MD5 9c2e51dcac7f79a65dfd5e38396d3da2
BLAKE2b-256 18c1b24b6250636c86db1158901390602fe5350c4871f3ee4d74ec2e25a55938

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503221739452835-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fe5b205076a91c3bb4c99ddf8de89f01cf97e9eb00793376e1e43b2cc6364de1
MD5 25f3b5e266f76283aeaab73f8cc37b58
BLAKE2b-256 175c9cd6b30beaabf386f43796ccd91ecc36f5e8c55115d2ee2624a844413dca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503221739452835-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ea7f049e84caaf69863b9dd9a14b913a11bdc677c1f40cdcf44a18d0ca55f030
MD5 0aea565122c58e66b7eb4fbe618f179d
BLAKE2b-256 f491564b4f3fe85c62f01a2ca3a96f60b61c1bd4d1950a070c00a761a725a61a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503221739452835-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b9d6e86cca9c797d97a360d3132b20f5402af6967e6d70179c3253edd129e201
MD5 e4f048203477eb574ce1eeb20433905f
BLAKE2b-256 618f295e5cb3437b62149c4f45991daa256f8c8b8aefee33728a6c541c8d64a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503221739452835-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 eb8a060d6aed98bbe6d02eecdbca7bb662562d48bca22958670ba2585c7aee5e
MD5 fefa4dc50a6e0da4fd0e61d0915e1a2e
BLAKE2b-256 fadb786aecf119056f7c92460143e6fe685ff4081673f3c77066bb1d7ceb9f55

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503221739452835-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0fed5f6eb596ce24b8cdd35d63cbf0ae5864b69450bd553ac3359efdcc9bd804
MD5 16f30df44469f63caaa865b0a2c3244b
BLAKE2b-256 fe2616ad7a59ff75d45f31b349451ccd42a82d81effec0fb4d084697806d3eb3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503221739452835-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5f96881ef3064271128799505e4dfb27fabc63e29f25f13f50d857bf43a31790
MD5 3fc82de6c5abbd722c41ac56612c2122
BLAKE2b-256 f5d275cc0e459143256850432599be4d0ea2c94a6549eae358992c914f3cf565

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503221739452835-cp310-cp310-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 6ccb07c6e697c381b1298654e89bd98e21f4dfffdf243b5cece27c7b69166aef
MD5 61fad494203647fddfc1790939b3e695
BLAKE2b-256 5f9930fc800a7b6188ceb0390c4953203c35b5fdbdae276bb215c2ee1647f4d3

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