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

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409051723794729-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.1.9.dev202409051723794729-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409051723794729-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.1.9.dev202409051723794729-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409051723794729-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.1.9.dev202409051723794729-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp39-cp39-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409051723794729-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.1.9.dev202409051723794729-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8cb94f1bf33df9564e482bb2ab18df421efc48b66d6a8c00b1f125f7474a020f
MD5 00b86266f4fdfe63298e7eb72cd5b972
BLAKE2b-256 53e283eacda87a1bea77a9ad1996fe8c53697fd1567ca367e9e64c19dff4eba2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 43bf20f5374f0af3b6fc52b7fac0052b328cef130d8ee26ec7842d3d6ca339b1
MD5 e7b9165f32f092e9abfcfcc53d9e818c
BLAKE2b-256 a5888f00e49539079084d773de43c0e50c5ca4bd6f865d8601b74090f9e61f54

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b781201d9030518e302156146c1afdac0b150b2f673eff666d387b50d8f6e5f9
MD5 a27666d97dd59be569af6bb716a307cc
BLAKE2b-256 c58847a883a350894d6dfbd5d7e9052a59f34c95fbe6a3c10c2517808a032bd2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8f4b0787c982a99ba6115a90d851e571aa978098820cad12a66717bb8724fb2a
MD5 2a3cbbc60e5049b79adeae6933369234
BLAKE2b-256 5265e6363325847ed3e3c5e84ecf991258a69650f73934f02ead622b09d195b7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2a669610fded6f0eec21eea39adbfcf7f7fcc97a49f99ca3af189b1d3002c298
MD5 07bbccd3341900c841a0f7c90f9c4435
BLAKE2b-256 21cbd83aea7f3ff9dbea5c6385ae52e440fd3f080d91a3f65a4386aa32b751b7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 25b58363a905ecd8940e2b473c21ab250d4b40634a87af17e3c472e62e577653
MD5 73d24aa3675421f4a3414d72087b2188
BLAKE2b-256 d076c21b79664a2a0cc5079cc982266a9ae3093bf19d251f87761de3461c5825

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5f32f50e685aa4d13484ae1452377402a5bf5cd9f0872db557cbf4d7e73e2b1a
MD5 d438d1a7e149530ab4780edac985411d
BLAKE2b-256 e7cb195d90fd7b0b861edf6773a75c55df0c2c0cc97adbe08266f64c6f37107f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9ec588b2742c3016dcd8edfbcf58dcab08b2cd4829e448d6677920c03d36d59a
MD5 9dd069b476a862d291c5038333a456c4
BLAKE2b-256 3ae3b51573adac5b26008218915bf67fdf0d8eaee056ab7d59125ec8db05f832

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d8554fe11ed475a76a4544cec8881e5ba452239013e8dbd34bd69f8b4442ffcb
MD5 a455fe8d5533c1f20e89053a2d18b807
BLAKE2b-256 f2cf6fbb2cf1543226881652118c001889465b9f03ab23d60b6a40246d683e55

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 67cde8772fd5c7e39857f3a8df86b3616f7c73a8616daf9f645479c80cddf50f
MD5 983cc285e8b2aed28ecfafd6cd4c9047
BLAKE2b-256 3af4979b716e5f00794922d1d05ba1d3d1dd1ac5f6b7abd729b942bd0d63f298

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 8c8150664a9390e27c9219fd299109e8500d7813d05b6a8bdeeb4d75c0523ac9
MD5 cfd004e5675ea213f55171871ffd3cc9
BLAKE2b-256 82770e7fd672b05c522d7b3438eb2f9fb38eac3986a54bc014c17d2cff20953e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b689082cfd016ce4baf9d824ccb2f1684d3fa620946de7a0a8fcf936a20481a0
MD5 62e077aac0e89bee2637fda62e9dd28c
BLAKE2b-256 f218c6a46f3d071605f9a4045afb2e94803e047cbacef94ed0bf35be97fab7ca

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b7b91bbab51d2a900c37f95315f325e4a20713afa01c2a13176685a7b9bcea6d
MD5 887a8b1f4be9152bf62407dbeb9d9d52
BLAKE2b-256 64a62c20d379a3570619caed629908cbe5ff0cc1f8785814bc128fd770d8bb81

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7f809492cf22ecfd616e6aee73def574deb37897771c3894396e5530f8cefb2f
MD5 a37892501da6bd8d8c3751e868cd4b4d
BLAKE2b-256 124ff1c2d026cef08b266c8a409257fa52f0b02350f2759c210e292081c09334

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9c2cb4004aa6c504f455c6da4b5652dd70f1ee66354603aefba47896d300de33
MD5 e50a6ccc02f580d949f3885f637a3457
BLAKE2b-256 66890501d2830de3e01c9032dbb62c251f0828662a39aebd0e7a25a695ffa813

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 2dc31b6d75ec583bf2bda4432e07e6482d8a73874b08be74920f6995babdbbfa
MD5 b5396d0c9b03963a8ff4522041521264
BLAKE2b-256 0ada7a031683efb0e2bb55ba502de10e08d0f08a14e30a1d230664ace4a1aeee

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 429f476fc72539d47191e180383b67f64dd32663e10d7d036b08a428492132f5
MD5 1ba2caddc0098487d4d77a670721266a
BLAKE2b-256 af0858956182708504edd10ad44180d547aeb338a7fc0debe39920a1f535cd10

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 70fd560c6cf6e6529ac094c35059349407d878617a263400ca276018b8ec8f75
MD5 469a0309d8223276e10e83194c02fd86
BLAKE2b-256 dc1aeacb74d01b97abb23b5d928dc66b0e6956658223b6a5c3efa209a08c8418

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 65e8dff9cc73022683342d0447a60bc5f53a737cfbceb9778ffc4fd965bf9812
MD5 cbca1d2fd22c0a3c0cedcac8c59ad4a0
BLAKE2b-256 8410f11ef20367994aa20e420fcd4ef85422586e7842c541a8a05d6022f8ccee

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409051723794729-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 12476fa6d2785f15de4705fb5e2345c17e5bfcac9ce905d8c2c599c47199216c
MD5 ee3190bbb8f12fa6351af7af64c165c2
BLAKE2b-256 75dfe2e406cf84ea725d624d6b283e8b4c90dd7e1f486892f90b7a48f6c2af0c

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