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

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407311721169663-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.dev202407311721169663-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.dev202407311721169663-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407311721169663-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.dev202407311721169663-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.dev202407311721169663-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407311721169663-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.dev202407311721169663-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.dev202407311721169663-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407311721169663-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.dev202407311721169663-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.dev202407311721169663-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407311721169663-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d3d527cb4726c0004d00ea3f3c0403c92ffd7699ea029323b58b7d766363034d
MD5 955b902efc272ff11602c951baacaebc
BLAKE2b-256 15ff8868a96aad9a48e9f0b597a58f78a9523bd13ccb079c16586446582a8e01

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407311721169663-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5cc6c4025453b129a263ff3fb1c7434a7f6511f02cc0c5a8eef1b2c348297a2f
MD5 924e9172d3d221bb20d93fc77ef35c64
BLAKE2b-256 d8d2975dd92cc9e8cc2f320ee2495729edc1496308e3f23dc112a2c719a7a499

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407311721169663-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3366488675cdb8a6c4bd0f8e18d89f50c255e5287cd360704d24f56b84cbbfd5
MD5 b42a388117519e4b281cd5e0a4d58328
BLAKE2b-256 1c5efa105b7a80dca1bc6a7e03a62ead050d5c26f85b500e4274726d38066adc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407311721169663-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d809cd0de3295982c0d0bf2265d4171eecdd2356d69c4b810f82799043e30257
MD5 8d3f3cf6d2f65913066dba728c1157f5
BLAKE2b-256 6972674218e33ef4dd94c1773580beb308132890b6110781de0f00865365ca61

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407311721169663-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ca719cd846b0a56c0b8c03cd3e8a520a08f6c140ffcabd0ba63a6c7ade68b0cd
MD5 469a66ba36d6533a79031f7a715ec1bb
BLAKE2b-256 d187490268fa0eb1add92801fc1afc374ffc1f3182cf8ebe740f56ea5cfafd1c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407311721169663-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b92eb5fff42c7fbc195bf6671d6f4ca5ed65d36ff52e6047eacd3ec97ca28459
MD5 3444c86cc1cb2546bbeb9e2bdc6dbcb8
BLAKE2b-256 964e0365aefcafeac07a6ef09e81bd58139f40b02fc2e043b0f8b8b35fb8a0b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407311721169663-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2ba447479c685eef7b5a7f81cd0bdd5281c5185f1e0a71ad7c57e6e83ca30084
MD5 a2219b486856ca84239e83945ffa90e4
BLAKE2b-256 4b319943ce3805720d66d378d0785cac9a949f83fa3e7cdb7a1715f77d1d4816

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407311721169663-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 66b4bc9be842c643fbd6b402d0f8dad63a8c95e6e506b7bd5ac73792756f11a2
MD5 ff3bc0247ba4a984b65193e9b59e524a
BLAKE2b-256 ba91d6d65bbe60f268b1cbe52e86931f0df422050169ec78aa49d26581bd9f37

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407311721169663-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d962132be6b13166ac858fa733ad0c09d5fed906ad9ce29cf6359794d4e18856
MD5 b5f58d8789893f834a396e45b3b72e38
BLAKE2b-256 3b2b9e0effe394c0f93c80954fba2678e3d417bf884b54d5c2beb9573f23c2ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407311721169663-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 304c4acaef10475b183e63cf75341e9252e1ede57dc61846d337cd8bab1bf58e
MD5 bc0ccfd7d3a61d9ce85a750ca2019e54
BLAKE2b-256 fde0d30c52844b15b41a201d9f76a48452b22a01306c2546b5936fa26b47df49

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407311721169663-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 55959be3dc53eabf2c44d644a997860144eb4fa353775aed970aa843008519b4
MD5 21130f41eaa001b8267745915537a68d
BLAKE2b-256 258f472b79124979a6ec28ca76470f4f88a1807a68642b8ab01d3d6669f60d10

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407311721169663-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a7b5a2681c557ec24176938e075e5dcac9c5999b5b2a172eadf1ebbb742dcaf2
MD5 fa918b00d4211eca2349b7c3b2af59a6
BLAKE2b-256 15a79c6eeb462a796056a457a6aafa69868ce86cfa62618a2bf3998813826fc1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407311721169663-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a023686c35bcbb85789258cfe7b7a44c2031e10e672718cfc160e4e2616dd9ff
MD5 921eaa7ae88d115008fdb001df717c16
BLAKE2b-256 12315c8aa848fd79ce5921f307fcfcb13730063dcac6e5f4644c2ad841cd6fa9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407311721169663-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0632ba6e869f243518c88df47b4cf046a45ca50160bf2bedbd603e0326832738
MD5 75ab82bfe5434c998935dc182f06716c
BLAKE2b-256 c4322fd73b073baae9bb59a2e1457f582c2f4822ec6483170e02294ee205f3db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407311721169663-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 36131bb0d98d7c3ffdbf2dd9682c54b72f451a076e67f9734a9a7547c1919cf6
MD5 1ac7cea2c7f6ab5ae80affa86b3de056
BLAKE2b-256 cf71f8e49a479845f5c354bf3dc2100442d907dcd0de3ccd69c47869ce487865

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407311721169663-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 227cc9972e2b614b2383f9b09076cc133b35d37832b56d740eb08da8458ce795
MD5 ae414db9919ed860e5c8c6b0781f7c7d
BLAKE2b-256 06e492f1f3839e46b453c464dc59fddbde2dac31e34b84fa64b76efe6ef5e0d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407311721169663-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0c89384a84e89ebe1dc5d768171165a41cb419b2a0365cf9b72fa03f259cf9ed
MD5 059e980a97243834bdc9335e8bfb8650
BLAKE2b-256 a87a6e0f44f8e8c186a2430a5083c571f6837ff182429b51540441867d23620e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407311721169663-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a014a0d901b8fc37a5175754eb5651e5f9cb9a4e2e2dd1ae8ce1f14872a4a662
MD5 e020bacd8bcc8cae876691d0448f3c74
BLAKE2b-256 175e5736fb685f048a339d9c855de0c4c2c0fccb38f220b4b85613999c1917c1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407311721169663-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 277525c83f89f4e9e38eea351665033355f84bf9f6cddc69d030270d8b219d5d
MD5 69c404dfc28dcb0e72ead47bce25e51a
BLAKE2b-256 09eabbaedb6ac430f1aa2d243bb931aafa82ecb0fbd597518b3251d00511c806

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407311721169663-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 735cf276cc0214844d9288d23f5a140458a48219c45a0fdccab86e70bee6d19a
MD5 0bf25cfb309d9788820ad6d7a01457da
BLAKE2b-256 88ed1b4370b680e6bddf24ab1e4276ad3f38d1f81d830ea59154dd56582d64fd

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