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

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp313-cp313-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp313-cp313-macosx_10_13_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp312-cp312-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp312-cp312-macosx_10_9_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp311-cp311-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp311-cp311-macosx_10_9_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp310-cp310-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp310-cp310-macosx_10_13_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.10macOS 10.13+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 c857d8406c793816f793876d2d19154955bb2aa52e835706643db8044d5634af
MD5 7d8cf4881500edf74f06e447423af1c9
BLAKE2b-256 729fff255e0303c801df7d5ca907c0fe309581ea16674807934fc3a4a30a34a3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0c5320e05db02672c249c411e6577598c8898c9f0c4d9ecb13bc633fa7e081fa
MD5 53f5863077093aeb6bca7714b6556c06
BLAKE2b-256 1ac8ba5d9783baf1f18aaa311e8253bae02523d0cc5d5fa5d9612e6ef80944df

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f7d6ac4e92d9fb2f5ef9dd6e2b1a20079650f4dcd07734c94bd77c9bb3d241a9
MD5 c27ff854f5e62d023f68fb0a4354c309
BLAKE2b-256 c595afe22a84dcbe06a979fea92da941c36a409f9ca59c1276519f61fc46bbfa

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 55fba976e0ef803af8914d5e6affc1b9e089bb207a85004bb91adad0eca292a6
MD5 4bd148a49bd042f502877b2835af2680
BLAKE2b-256 570d324d555ccce7c49841284390438794e2b2858f9b4245229bfeeb3ddd4948

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 5ce47082001c0ebfd6e4fbf1f01534304c0f08311a6cc5cfde42aec3723d8c38
MD5 df12caec690b48d40d9d3337b0acfb83
BLAKE2b-256 9745b779d0a40eb3cf0fa699df768f36d9e4203462d2f3a88c47932507bcd7ee

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 87dd7c9694c89a481d9f4b6a3bdfc5d475de0f9c2a461bda1f6888149de6fccf
MD5 e726d03008e5a8183154f432a2db604a
BLAKE2b-256 c31ec892c6f9535c54f1fc9ee14d548e4517eee9d226ce0ae4795379d1be7689

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4b75ed2164cb6a29dd312a1cc4fcd2ab6e95670dfac3cb75c6f6b6e187d6ad0a
MD5 2c5292f7a8ea3fc6f91c7abcace79884
BLAKE2b-256 447973575254813d92d3dd655cc73e0fcff5d3df29074f81ec181082c112e80f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9a3d5e1cf84225a35cbda9571816add26256a6610d5b5b811d452ef2fe2e627e
MD5 d8076faeddc57e0215c00165c6b8ad61
BLAKE2b-256 d769bca1fdf2f60e802fcbf9e785f600e81c2fdf2f8d2ecf27cc9614562741f8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 422189e51fe5a3b51ff8cac61c934b938f42001b1ea13d5d017c38e09ded3757
MD5 dcf6a172a8d049b37415ac4a19311b7a
BLAKE2b-256 b9c265927ddb8914896171a56f97aaf894e2475abf71af9a64c84faa17dc61f0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 54b4addc5e3195282b5feb6233d37acef5bac05e0acec6bb139034bba8e2c396
MD5 25177530e14a14608ddaeec24d27191f
BLAKE2b-256 98192d4be197c23401529eb867f1fab7134a2fbc3bc1545e297b44a0e51a715b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 6230df5443f0b534fd7d4876164732d8419617bc0d25cb8fe772bf21ea767517
MD5 fbbbe508d6da292bf4260c0a3ddcbfd7
BLAKE2b-256 59b79b58dcca3af41e4216f59542c76547e7a40a264034dba4ee8892caec2929

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2da94a4265e4cd0f0ac1f6c83ac2c7b6c9f417c049a646d20e44345fbd8a91b6
MD5 b4fbf06527f4de73eecc767917edb895
BLAKE2b-256 3274c84e834c65498fae6e7f5d68ea662190f5849df6f2e127f96ab7af97f518

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4229603625efcd6f4a71d837aec093e5e87c585f3b22a6e338a42d29f2247da8
MD5 5dc68a8977d1132774126e4ebbc0a982
BLAKE2b-256 ac371d9b1e26758a3af73cbaac94ec69ac36585e26b79e6773fe8a719d21f019

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dc1dd149f4b7fe85ee12308bc8bd89456313ffb30a4fcf03a6edb4644716079a
MD5 b07f9532e39eabe7f878225bbac08662
BLAKE2b-256 1f5cb81ad9b0aa055b386c3fa0e82d410fe2a422e914cafefa55794c6fca981d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7cbf084d5966a9d34723a09c01b41197ef4c250bada54dfad5759f0f299b0785
MD5 25b41728678336432b12e21d26e80a7e
BLAKE2b-256 f7ce788186af2a30044b5f03595841f0b84b7662e03594c53be68866fa90e579

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 83574e26eb492a828683d9927422e7be51194c564bc85054cb3e225cb4e5e415
MD5 644e18dc0f7ea33cf759a0dc30ffcfce
BLAKE2b-256 f4b6c94be34e3aeeb51c30e79b871d60ffd8e3ba0643536a26ab0ac6a21f634d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d74e4f35dce906313f98755a3663e15cba5a4b615dc538b8d5a5d8ea1c151517
MD5 65b14617b06639e0c798af5c7b5462c3
BLAKE2b-256 978f8dd383cfa09d49eaae3e7fa6c35bd101b52b27ce98925b21d11b1c88c398

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8b47f6aa73c363c42019ee70c0492d4377dc17a6c05f5a16a2a734ea8b5678f4
MD5 21b5066fa2e5d4c8d22badfebc721eb7
BLAKE2b-256 ca18b830e5607d87a66599ef3485f3f21a4d093617aaff6b6a843e6d1b5c45f3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8c770cec60b4a79890d93e19f375d714429174bfcff7aa80eb225d89c5d8946e
MD5 882fc0c3042ebff11403b7a885e6116b
BLAKE2b-256 1c4a69b464243a123e1228bfb5aa49cec0acffcc5c83e78dbc42bd8f0a7ca998

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp310-cp310-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503171739452835-cp310-cp310-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 a947e9db4f950176b19055224a17e77a3a44a24100d5c99ac1de273a97d36701
MD5 2e7bf84c0b458b0c12531c2dee8f96e3
BLAKE2b-256 cecb6ae6d84bcfd6263f994e0b9b1d07db0cce66d644c85771dd5413124dd424

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