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

Uploaded CPython 3.12 Windows x86-64

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

Uploaded CPython 3.12 macOS 11.0+ ARM64

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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.11 macOS 11.0+ ARM64

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

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.10 macOS 11.0+ ARM64

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

Uploaded CPython 3.10 macOS 10.9+ x86-64

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

Uploaded CPython 3.9 Windows x86-64

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

Uploaded CPython 3.9 macOS 11.0+ ARM64

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

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407201721169663-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5483e632cc05b31bfdf60bab097f1738f15c08d6d572333409e853192ece8278
MD5 9cb7e42fed5e95471d1c5f0e4c365398
BLAKE2b-256 7587ef3a08363dd08b11253e489756a4804677ca4cc04fa638f17773237132f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407201721169663-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a7bdb8fb6554e7dc1d4ce5e5643c1cafdc93872c2588edc302f624f4b10b6db8
MD5 7012f1caa01be31907828f1c29942c7f
BLAKE2b-256 630aee8dc3d3780c3349325429f53fde1ca01e53b9d858754abaa736d4b36575

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407201721169663-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 70a34f808a9e770030e73242e47bbc3719c0aba1d3b0e67245cdd9c5efa1fb7f
MD5 d93cbd8e81ef9181ea3c13766bec822f
BLAKE2b-256 77a0c7f468c9c1108f089058faf6996c2fdae91871c5af865768c519edca5cc7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407201721169663-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b05de887e7b8600053fdc40167a9d49b06302539a21e3cae557e1b79246319d7
MD5 222c9e5a7ff733461e498ef61cb082ce
BLAKE2b-256 9755c74c08d92bf98faae3fb1d9bdac903a60b6fb0ca44dd385f34bc95a5c945

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407201721169663-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 673e3587ed3e589ff28856599a4c72d6272cbece3f72f9268b53a533fdd6a098
MD5 06e53b86f62a7ce65c0364ce2df9d175
BLAKE2b-256 673fadcd3704e05d7ea06b54500b30cffd49930233c775ccd45571f3e07a9ccc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407201721169663-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 9050dc3090389f1b54ee456720a662f2743e40e58e7274aaf1c6c469e39307ea
MD5 0bbd59bfb95a09d9eb2659626052335c
BLAKE2b-256 75cb8e312b7d1dd05f07770098a3dc7490373f57cc97c446f2196ef20925e3ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407201721169663-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 31124d46da98577a50a443dec248ade355f6936ff65ef6d83ba0fe98ba82260e
MD5 6bf6dbc3b2445d374b03f03fb1ab1177
BLAKE2b-256 0e7debf0e92d7311c551f944e1117466c5a9f744673638ae395ebd2c57edb930

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407201721169663-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e3e21f548707b65fff91b95bdb77daa3f98fdae53f79ec77de6b12809c2385fb
MD5 f11c70279819880a955e57bf2a3354f0
BLAKE2b-256 8823b8ab0375cd31979b8e62cc911fa288e6c8fbefc65f35c0f14402307d8d26

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407201721169663-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e974707e6ea2f67c1d91fb501dc34271fca34520c9caa60143fcb2e3967f0a9c
MD5 4a8522d3e0c8566a6f79e78e35719b23
BLAKE2b-256 dc1c0cf51b6767c29045d29132aca2cf1477f074d8aa01bada44e83e5d19c3a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407201721169663-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 36858e1f5a36126a3d5ddbd50929c1fe059a0f5a8fdaa014b38ce009a9c0a60e
MD5 deb34e01785601e15254d7854a1e6ada
BLAKE2b-256 3b4bffd59195add2a26aed7d36ee4142d1a2f8d9e95bce085b5668fdd0e2cdd7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407201721169663-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f2a7b81b8d37aeb076eade8736580b307b1af9f9dd9a5e341ec0a75d9c686bcb
MD5 e824769c212bf63b07c3c2760ffee9f5
BLAKE2b-256 ff01acb61c70423ef75e88f2447f78f5795d69c84979bf12b5a8b2c20dff9f3c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407201721169663-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 529cd02418bfd4b11dfa618e66c74408a8d4e58889b01a331efe4a114974d2f1
MD5 0f25e2a35a44f712db29422a6bbd74c6
BLAKE2b-256 01c8f9b0d0ad8c70dc45b191aac068872e54b446391653da4b6b3c6b1ff0d16f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407201721169663-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a2c7c37cf373d4b1eeacb8f549408c75cdcf41726f0a7091586fdf8bd060de06
MD5 69f1756cd8d0a4ca3c9064132f3b3987
BLAKE2b-256 47d044adaa438811ca68a0509fd0d5e9e86b0ab4808210687257221de431b3c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407201721169663-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f8f9e41c3a98c380339d35584cd7e241c6c4cd6514cc74d29630c7fafae06cc4
MD5 bc0f181c366329ff6dcbc8e3492c86e1
BLAKE2b-256 f034d7b8399f795f97540417d3621697d436078baaa70f75370edc0e5b5b2253

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407201721169663-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 323457a9b07c99bad32cbc893b38b817101f8f5b18f4fca39b054400984b5dc2
MD5 ea015d74c2057a6768787b4637af828b
BLAKE2b-256 b87076746394c1f3d6b341080804daa63366f691784ffd4fdb38eca9c04ce91a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407201721169663-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 61ea79ecb314fabf638096a7865e0910da896c3f6952e9308f4a847a3fc5224f
MD5 960ffb05618d6ca665713f3daf7aa671
BLAKE2b-256 594882ee79ea4b6d56c581b52882c320a7b2a5c327dc5faeb9f0a2beef49e84f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407201721169663-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 48daf5b421d8a7f6ab1f7fa5eb4f18928f17fc2a8dd738b60c7210a416b43652
MD5 8a42f04545bc490eafb7798b25bbce44
BLAKE2b-256 7c0b494283b1e7bcd02f32b84f6e043224dde22b369bba4d387f16a0b2bfa48a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407201721169663-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 da4a1aa5cf37d2b820e189da85657ce8d82945c39793888612afa225c612a6ab
MD5 222c2230a9edd31a3fb09dd0ecb98896
BLAKE2b-256 ddb746a5521f6739ab143f45b9ddd6f339a710b38180c1c7580d8843be5d385b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407201721169663-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b320c502259eba2483d385af2c258e878e7c82b7c54124cb458a31a37182a110
MD5 574aece0aa671f7833791d0f1f3b8c20
BLAKE2b-256 fa7196214f504cfc89104ac68b293bedb5bfc4d30b3324b13df04a5834f7862d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407201721169663-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 311f0d51dc7c40b344b4fd806ac2454f3c34d2a0244797a275304acfc4043303
MD5 93587bbcdf504299199b1ccc3487925d
BLAKE2b-256 f03324b30ad34a7889eed4f1b9a3e67ecf6cfba577d924e41197f2cc300bab1c

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