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,2023 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.13.1.dev202404251713370971-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.13.1.dev202404251713370971-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.1.dev202404251713370971-cp312-cp312-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pyAgrum_nightly-1.13.1.dev202404251713370971-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.13.1.dev202404251713370971-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.1.dev202404251713370971-cp311-cp311-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pyAgrum_nightly-1.13.1.dev202404251713370971-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.13.1.dev202404251713370971-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.1.dev202404251713370971-cp310-cp310-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pyAgrum_nightly-1.13.1.dev202404251713370971-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.13.1.dev202404251713370971-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.1.dev202404251713370971-cp39-cp39-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pyAgrum_nightly-1.13.1.dev202404251713370971-cp38-cp38-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.13.1.dev202404251713370971-cp38-cp38-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.1.dev202404251713370971-cp38-cp38-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404251713370971-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404251713370971-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d5fc117ee9ea819603db59b21bc8dd48361932a64a997ab7abe6ae3e6851a7c4
MD5 1cba9d679f6cb45a67945aaad00ab968
BLAKE2b-256 7525bba713b1da5f606aa294084d6918e3973b7cf292636fcb5e0416fe045898

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404251713370971-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404251713370971-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d879aa4a9ac560d27685e457fd5c3abcc85f5cbe8320cc72f8702c0631a3cb5d
MD5 5cb7d1f34c05e7c38fd154d7b19ab5d6
BLAKE2b-256 748c93e53b02e095957864fff1ea4ad53d09978dac0aa86eaa45c906c676765a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404251713370971-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404251713370971-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 93b3c3cbc9bf3c151a9914785bfc8c3f61bcee46c02180c8fa67d5c295755f77
MD5 2ffd8c9227da26ab9c72b092a872b710
BLAKE2b-256 5d91057e874741f43e22973fd05c49774184206db715ad70968fa0d6bc9f3e2b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404251713370971-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404251713370971-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0703f6f33ac4fc7feaa39048f87b29e9ad9d4a8cc61db71f5b46c0df9e7c6365
MD5 4af2bd442f225b2a5c882cfbc258596d
BLAKE2b-256 d00a3e189c7a66e99d4cf77365cc3b2839c46ebc4ba08983f81a0bb1be264ac7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404251713370971-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404251713370971-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 14b4f63b995b110e5aa40fa38fbae7113aa54a570cd93456c26c6e20f8842463
MD5 243f821a7b7ff0b0bb7ae810a6cd406e
BLAKE2b-256 d99364f7093d245e641546dfff2b51e082819443606e1d124f54d316ca575177

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404251713370971-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404251713370971-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a2641c6244bd6d31f47cb527ab153dcd47a723fd580ce921b8e35efd1fc69767
MD5 04f562732797a83ba257c2b03eaa7502
BLAKE2b-256 df73794ff589623c02744c6e3943495f0f5833697eeb4ffbd00fcb86bcf314d2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404251713370971-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404251713370971-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8491a1f9f0d85cbbb473257b99f0e865a6894dec10d9eb9aa5a24883f68501cb
MD5 208094b277debb277a96c5703335346e
BLAKE2b-256 dcfb84868156f9a2fe361da480c9eab0174f0f9266e1a1d760b8a3d3f66f71a0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404251713370971-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404251713370971-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 09d718c427a1905d3fe173e55ef4d50d3d8c3d4e62013b31f38549fc6077ee46
MD5 2df01239f3c29ce7afb772bac1949851
BLAKE2b-256 95fe946a0fb0bf3d6dd8e91b8d91aa7ad71a1f8106dd40a1c9a2be4ec48d255a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404251713370971-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404251713370971-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 df3160288f2f66698233685a2a11d5498da0577cc76778ab754f14b584a66627
MD5 7c9e600705cb30fa392067ff52db6aeb
BLAKE2b-256 20eedfc9067fc2cc7a2c335eaf5a6e124779a0f99b14f31dd36540fe07c92ef5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404251713370971-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404251713370971-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9b948c2dc75421b1baf7fd03472d7190d8da13b0d5ea8d5395b18e4f8a2951a3
MD5 c2dca9e8483c58a2b926720924e2f8e4
BLAKE2b-256 eec73a92d39d412ae9d12a2b13e051cee7f0a27291d00866e5fd7f5116ead553

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404251713370971-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404251713370971-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 9657c4a668e33f700dbbaf9aa4ff9855c29c14941bcd505dba9907248bb1d7f9
MD5 34e8dfbc179f4d29762ee3b1effd0fea
BLAKE2b-256 df1aa9b62d4afc8f68b7ad16bc2532b2d50dd23d840b9cfe8e1d8aa8f69fbf1e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404251713370971-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404251713370971-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1883835b1b88f0253bfcaf7e0e389e6d786904db5841e1d996a22109c9ae637e
MD5 35639156cb28ae0c47254823ba8afbc9
BLAKE2b-256 a79712ac6b685b12f1fc27bc74f09af9a1cb538275b374a6ab204780990e7658

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404251713370971-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404251713370971-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2f85407a10dd99ea774365e79e19351f7372c29e7965810b1ec506cd0de27f0c
MD5 f93f3e423cfe45fb8b41e9845e294acc
BLAKE2b-256 3460fce8be05a37096b7983c831ffd22b2fbca06abb23b8a4b0af5c67a7ca59e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404251713370971-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404251713370971-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e564b54e7835ee3a1caee05729532d6273d07ceb954a975727e7be12839c6c80
MD5 e44fb0129e5de40faf7c988fb4ea0239
BLAKE2b-256 5c76a8f25c50e4013c805f01ab74ad43014968b0054fe31750cffd8e1383be32

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404251713370971-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404251713370971-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1923a03bc9cadaa1e478ec22f4f2fed83fc376148b6b61469e62c9919cce0574
MD5 a5a4a5a4bb6ff6d64c150c9142eab4a8
BLAKE2b-256 0a3735fc910571e2504da4b3bcf2137df890d22a5d807bf4a76e47e295704b9d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404251713370971-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404251713370971-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 b3c38678900bafb2bb90e8156a30d1da319e448b0e27ea2d0d6067436dc162db
MD5 874496d691d1e4dc5035a6497e3c3de3
BLAKE2b-256 829117bdd950f57ee707bad372193afea671e2f145fa039f3e9116b0439539ea

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404251713370971-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404251713370971-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f6896fd3b280165f04e5554c4964a3238cddd208e80f2f870aefbca92c58e6c9
MD5 22bafd4ced82e5e39dba497b55222f77
BLAKE2b-256 3799f43d33210c0480c4466d3930af069cd17e1405bdfc82eacd34a5a5267392

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404251713370971-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404251713370971-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2249803676491fc0ecd3dd37609f0e606fd13f5956ed81a76a3361e8ac9fc80b
MD5 9b327ed798b0570ee7a674e7702cbade
BLAKE2b-256 3fe98c87533e828f88fd7922b4c752e41ec560e5a178b9841f3edfdbabd032a4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404251713370971-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404251713370971-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e30bc289971b30d6deacf77e1a0953d95f2b7ec8503b7d10506d8f3720abcd0a
MD5 fc02859a169af10f22b18e984f1016fd
BLAKE2b-256 19308bc909780e90ee03928a78684f65ae4a7ac82303985f649e3048b553f88a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404251713370971-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404251713370971-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e16c0bb03f6a14ad9b53a383787a6e5ea3bb5f9bbe27d9d3a00292c20d7dd108
MD5 d5b677409f7723ceb08dbcf64e5040ca
BLAKE2b-256 4a918dc875c116c6ffc234d5e4d94aa6fbc701d2c9662a794a1a36131ccb3a88

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404251713370971-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404251713370971-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 77e3b6ca62daf94fe6b937334f3d119d3bb4bfb6236dbd18ef7b3780675eae16
MD5 4556bb27b841c3b7affdb3242de88af6
BLAKE2b-256 ebb4878c1f7c0d4bf6fbf493e34eb3cb45771eb480b1f90f5b558cc57a517f09

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404251713370971-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404251713370971-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b6e28356f98f3dd8d09411a2d2393dc3f6132432358fae92c1ea5c5994cac584
MD5 6539c2223b172fdb0f1fb251ee8aabbe
BLAKE2b-256 ee30ebb717ccf18d84ddf84c5e93c0c2df36f5118ca28907364b463841f3cacb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404251713370971-cp38-cp38-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404251713370971-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 55dc48ef44a0bfda22b6ef07a4bde010b745815b39e30d4d6ef7877830d4114e
MD5 d2b45881fe357b897903f3391bb2e1d9
BLAKE2b-256 b259f5e177704d2f3a70172c1ce2ed49ce9859e17e54498a7dc78a789a21a2c1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404251713370971-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404251713370971-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 05c129b30987aa66c925aa30b31ae6502b2c107b692d14daa9b4433bd1b0d3df
MD5 9a4b171993676c628915bb4921e72c44
BLAKE2b-256 b0c5afef5eb3f3f6d42d56b374a30f819827f647ad85e29683b0f2cb9c6cc649

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404251713370971-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404251713370971-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a3cbd6931c0e2d0f4ecde726231c1c84e6d0f1e0cf96fb357d541cc92bcd1df2
MD5 84239acf0deac33243eb91be6d9431c0
BLAKE2b-256 be94db1c33f9992da22b725a4a06160fc49d0b631cae0419777bcff793a0ff8c

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