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

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.2.dev202412271731932516-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412271731932516-cp313-cp313-macosx_10_13_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pyAgrum_nightly-1.17.2.dev202412271731932516-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.2.dev202412271731932516-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412271731932516-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.dev202412271731932516-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.2.dev202412271731932516-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412271731932516-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.dev202412271731932516-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.dev202412271731932516-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412271731932516-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412271731932516-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412271731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b10de8eb5b06e46bea345180d6ff6ac943a6ba2d558f4b26a4188d15441e416d
MD5 515e87e2ebe2b15b9c780467030bd31f
BLAKE2b-256 e6798851933e615a81f4680351947b1617684032aa7a03f319d0e90d9b63fc23

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412271731932516-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412271731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 15d27a3469321d4fe01b9968c01f4904abbe2ebdb6a2284f42deb0ad1d4854cf
MD5 f6abb65fdad0712c5fe1da6f289561a7
BLAKE2b-256 2a83f966339c4965c654189a95c5f0a03f24ee2a7f9d447effb62e0943173025

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412271731932516-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412271731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ddd1277b5eeeb4e19bd008437ed3bbb1c8b14f4d9952bc0c8655285ace579fc3
MD5 11056b8c2ef9811a8bee616fe156bd98
BLAKE2b-256 4e2736f80e7f293d0d422fc61cd6949c12d0c1889fc13f7c7ce4a61b3c5cb60b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412271731932516-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412271731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 29f01f9d768a997b49e5c9281cc8d68124e2752023779ccdb70d16bb5c9def1b
MD5 42c288dc6260b73cb92131da23d31fee
BLAKE2b-256 78590e6f20a6ffb461f4585e2eb795fad9dd662335891bb666f35eeebf6c5a2e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412271731932516-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412271731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 c06f7a0c99378a1b109c40428b47005ca9a53f4b8f27efaea5ba4226c61b813f
MD5 a019ea57d1e0256362f1e34969a64cc9
BLAKE2b-256 8273645cbc4865093b84521106f5913d3d1d72064a962f47542b11c98d3fe5d4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412271731932516-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412271731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 7c079b7633cf45132575b06db179038ae056a6901967965bd2d619ba6bcbbfee
MD5 38e1eb5f48930c47145eda20830d4bac
BLAKE2b-256 6fc496b4e595c33c3b87fe28400f46e3186e2b3d5bdc64451dc7f7a823f3d3b0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412271731932516-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412271731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d04c49288345e2995aeb65ed695cbe757741bf65d883a4e04bf5f547bd013b3b
MD5 b5688c16ef62b1b700064e3534658e22
BLAKE2b-256 eac82d3a54fcca701e1b400e7bfcc62344e3e89b2c81da6c2a0286e3b40f09f1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412271731932516-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412271731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a985ec0ab5b34916f19af43332587ee8288f412e63f11d275c857237e7107009
MD5 661df8c1740cfabcdfda0df96bb16017
BLAKE2b-256 b306c80d8e304f91d63dee98f4e10e7025b0faf4aa77cb66bd653952c2cad6cb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412271731932516-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412271731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 191e8945b4f4f0288460695686058be1fb055a949fc7f1b185462e8e507cfc4d
MD5 401e9df91b9dc8242bf3c047eed833e4
BLAKE2b-256 ff3920b3b013bdff6353875c1e511324b5d080217c96f5be47a5981f49c4e742

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412271731932516-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412271731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 88f567465b216d79cab35b1f4f582eded8ad266b6a83db7921d0877054496058
MD5 4fea3074711fe157b2df91f4a1e0ef14
BLAKE2b-256 34254ff218c04a7045ff0b917b0ac4404c9d2649e0ad8e1609d383de604a3e3d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412271731932516-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412271731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 53fe21101c38e9871cbb3bbf298c73c580b22b006053d19872b35fc6ce0487a9
MD5 6fe6b1f1143b305f9e383a6e51c6aabe
BLAKE2b-256 6862a9206cd58b7aa90db908d8039141a9257eb1ce34270db8df0efcfbf15f50

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412271731932516-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412271731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9b73dd26301117713988ac10294ecba6bdcdce519f19823a65597c32562d0b8e
MD5 ad605d4b990a5cc3f7b534931d33e6f7
BLAKE2b-256 a2c40bf88da7d0ef3ea68f1fafed3de6b579f0074d972f6478387d76bc1addde

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412271731932516-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412271731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 37d343f1cb4220f3afdf7db20925e758d1e02482e1a932cdb284c3bf227dbbcd
MD5 2fe076c3e382c851ce8bbcd4f0e896ff
BLAKE2b-256 ddc778063d4a6364e1e7cd728733b6637aba42181156e2b18c18c0c1329764c3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412271731932516-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412271731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 28c2989088b36f65343ae624bb1abe83b9dee6812662dc8e2add6a9a6776a4f3
MD5 75613f8bba4bf14784ddc67f267915a2
BLAKE2b-256 f54ee1da2ab792566c4b76e23dfa19e956d577221f1ea9e175967f06f09ae1cd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412271731932516-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412271731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 09834457cd243923111e3da27caecebc7860123d5be02653bf4edb8238aed6e4
MD5 c98b96e011f4ffb92dc7702677ce1377
BLAKE2b-256 059d45e0124f30389b3a023552a421a3e8f9c66c742b1e8aa66a0fa296ec360d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412271731932516-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412271731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 37a8736d1fab912db418566433dd1fca5c590bbd0e4149f9e18b31461b495d44
MD5 c89fb2ad658abda44ca9603cb98636d9
BLAKE2b-256 72457aee99e96a97c75435e496ee32e6897ee02b2201d99b1673d42c8752e185

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412271731932516-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412271731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0cdf80047c9657e2657f3db4b9b740733cd4a4889a73c5b47ce912951ac638e7
MD5 12545bbaf298d939494048718ee14e45
BLAKE2b-256 77ad813b9836ad8dc3522d11879e6979d9bc596ec023e859b919bee46dc5245f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412271731932516-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412271731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 483e41f95d943d657522846fc6eb1cfaa29fb6132f1efa99f0b05f0b339f7b7d
MD5 ba244593ddfbe467c96da921b68fcae0
BLAKE2b-256 b7d4d1436c3646e9557506a733d6d62a23eced9ec75121e40e7dfc72956780bb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412271731932516-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412271731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 121f85dc7a1ea4eae73a71173ee471524eed06e67287a2ab8ad61ee323831f6a
MD5 3910db76062f0c911e6a04b31bbe3f5c
BLAKE2b-256 a48d269e49530544e926e6d021ede58858b25fb442099f12340411eccfad359e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412271731932516-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412271731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0be579684aea3e0bbe673794bd0637614db1f5f8db1dd8f2f4048124253b13ed
MD5 e4a2476936ca5c30de6ae3091105e667
BLAKE2b-256 e03928ee53db67a5dfc50542f6aa86dc077b8da2cd32f52153c4cec18ae59d5e

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