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

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.13.1.dev202404211713370971-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.dev202404211713370971-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.dev202404211713370971-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.13.1.dev202404211713370971-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.dev202404211713370971-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.dev202404211713370971-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.13.1.dev202404211713370971-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.dev202404211713370971-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.dev202404211713370971-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.13.1.dev202404211713370971-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.dev202404211713370971-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.dev202404211713370971-cp38-cp38-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.13.1.dev202404211713370971-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.dev202404211713370971-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.dev202404211713370971-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404211713370971-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5c0f92b8a48b5e9abed766057cd729953cba669de11a792005040caf1187deb4
MD5 18a8a348da8b8a53df3b50e29339d823
BLAKE2b-256 022c3dafcb1c8944691a16659d247dd1a522d57e1b5cf691a5203b55b04a9976

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404211713370971-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 00270bb5efafc56e8de4237ebe740f0b8b70b7a69f76a28b8c5c137050115b83
MD5 d5d2bf72b8891746e3de08ec024b74be
BLAKE2b-256 9e903f82c2bdeaf59375c68a45330ec1223f225f7d2e2cbb94f1115c1c970f46

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404211713370971-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a8d3ba148f10aa441435de2b575c20416145fc797159c7b2f169b54a5f6e7f6e
MD5 7e3e39eca3827d7d2504d7db4483e0d9
BLAKE2b-256 ffc2fedd2406fec374fb5c8ae647d3ad82b967a482c5c69718c3f31068de485c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404211713370971-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b9d0260b46ccc741f46d3bf13d0592c1c85495067efdd291f5f0ef5538306bd9
MD5 4f547d613a8dc7718757f35c1d08f1a2
BLAKE2b-256 e09e99a682042ce7e0c962e4147bc5579aee6e889ff221d9fa088a1177f4f9b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404211713370971-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 96379fa1ea84b3937822879e5479fe94668a260b259efb92aa7d19931a2ab235
MD5 a40556c30d41a4bb1a7c8f1f81a04556
BLAKE2b-256 87e69ef61bec55587a09b71103f58d7c1e23d48661dc0ef85e13305dc22972f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404211713370971-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 28eb2a202f3e77b59a2a2517fefe7da3d1d7241bc61a517ca06ce478cbaa7377
MD5 6d4fef2114169b8803378db479c7ab79
BLAKE2b-256 54c215fee5636658764eb39379828d5c69bdf9283dc9b99b1ffe43fb4bc2a0cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404211713370971-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 84ee4354fadcf1984776476faf63f3ca8bfa98e515129eca41d5e106182a66ca
MD5 87427881b8295e94aca5aa4aa26eb4df
BLAKE2b-256 2c40022cd952c48d8c7c407d9c5b22446ca306f4b3b5bc2c020e11109073083a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404211713370971-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e69014b0754f6f057e6d9bafd5625b834729415fa6779e98bf20fcb3253da1a8
MD5 b9e9a8caaac305f88041e6771e5d7e9f
BLAKE2b-256 7097b06bd6d6dedbc1acd21ba66534daca3e30ed0334d68900278368e2918e70

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404211713370971-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2230760e0531c53e672efeb189cadd75d8c782a3d6f2fb9885c180416ad71e82
MD5 a44ad67b7711185692153ebc7306d198
BLAKE2b-256 c633dc2056027a33c3b6217b78afbe6520e70afdc7301095333e8d477aac05a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404211713370971-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 405587db7d813d7a7b2410c36395d1d16dafc5792e88478f89ee4ce4246e4b4b
MD5 e7a11198b801724bd58b8594090b78dc
BLAKE2b-256 79d8bdb7f1d41c32500dd86ddeed2d6ec5dcc7f9fbbd11aafe2c72272558c459

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404211713370971-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e58056dfd87f83645a23ae4e09be6e0747c43c9a40b56217694dcda551423e20
MD5 9d837f7703c1069bb391fbe6685c2ef8
BLAKE2b-256 d1a65ceeb481a108c326700a495e28dcb3e91aa122c1c0baec558e8e52d3af2b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404211713370971-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 754e9b2889972b5e7f006a39055050a14e6926b37df13c03c3738d7c3374469c
MD5 300fea5ba4afd8a0410a9a818e9b124a
BLAKE2b-256 1441fb7883652ace696f0784ad628d87a1b1072f946b48de5c66f423020bcea4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404211713370971-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 02588d4439eddd0d62f059926d4d2f5643a542790b9e3ccaded2db4735263e8e
MD5 ec67c0f8f91cd36802cf28b19f500908
BLAKE2b-256 43fc8c2a865e141559dd5dc0cd1288f154dbd3487f9fe1d3980cb2958179e43e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404211713370971-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1c7e6f52bdb44d981a91009c158518ae0c73f5255c09def93f25434bd1657baf
MD5 f9fb9b60e1a6576d9040a50bfbb3d460
BLAKE2b-256 aba6a8daad72728fa3d20b795d7fb46f66b0ea9fef7d16a605d674ad0eb89fc3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404211713370971-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c344e69e445bcb269a690f8b5f56976114ebd0f0ba0dbfb6a822a126093bf437
MD5 aa3ea0d1b9659376f38f8d61c35d68ec
BLAKE2b-256 7870dc2bae6db2920523f5baec65a44773c4f729c83e44290bc8c31474b8154f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404211713370971-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 685d60daf78823e7ab83aedcc64653dc6bba15280cfbb35c80fb31d4beaeb2ae
MD5 e48ea6f61e17f304d559b1dcf846f670
BLAKE2b-256 0eb11543609e6feb5cb4348ae9ccacef21563a1fde51cc8d14bdf91d70003e29

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404211713370971-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8ba2a00a45b589b0e4a2d7162dc0cfa55fb8f5d56c59ca1ef2439519c5480b05
MD5 953377d9b411884f04b60a25ad325951
BLAKE2b-256 06623d1e4c895a3a58c0bb34098e9ba0740dfc67fc24176515bfd41f3377b7c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404211713370971-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2c5bf64f27690e82ac62d1789aff99567a7256f504d3334763ef168523a93a54
MD5 6e5ecd40715145fdced4b2e1eb8b7247
BLAKE2b-256 7193c30c006297f85a37ff886ddfda1d0f7c501275e422a74da36e4765c7c9d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404211713370971-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b9c6916864e67e196765fa98d77b01501eec1afda28a4c0aea6c99678f22adc4
MD5 92ad42f2ce4da24d3a4ccf3ee9f2c02e
BLAKE2b-256 2fb50753e3dd79df2a601a338640d5b28250830af9b0a55b54ac6b0e3ea0476c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404211713370971-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9232f0f1d4fa932a5c26e49152632f87257e6e24902a184fb7e207af80323c1a
MD5 75af6588ffe95c92ed43452c07238cf9
BLAKE2b-256 47d8ec878c724fe968d61719b3dabe4eb67a3e354ca73b9ed6a1a3610b9b73ad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404211713370971-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 c37841a8dca8a37ddb803a167be769dc00a678fde3d0ba400e8e0d1b133fb489
MD5 f443a7b976c9e37ea2093d6d20d2a979
BLAKE2b-256 b64cab268fc2b3f12a9bdfe03ae05f09fe2aff92d6963d1860c5b84eea7b6d38

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404211713370971-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 16b453ee4d559765f2a9e28e2ad14ce9ce996945c324924ae39c6e053014a780
MD5 1a1cd306898c8283022e493d2f178f70
BLAKE2b-256 9ff3f0430e50561dc2f3d3b4795bc60c754d132ba39570574016081d1f08166a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404211713370971-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 55b3bf3c23ba7953561902d01f5c54e3b023ebd23ba61e7fb4ad1a75d744cc5c
MD5 5bda2d3206c555a80c579a9f0a7daafc
BLAKE2b-256 8f8e6b954c069341bde0cab26b788fa267d6066562f9348ba0dd5fcd1488a0d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404211713370971-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e2b035fba837bf022f910db0415ff039f2dd67a35b9ae82e01230b3c5cacda31
MD5 25c5b02a709c88251a1eb112db19de97
BLAKE2b-256 65e29f939f1cdea0f181d4ac895e0958da62e3d5e3aab6bfeb41430ed730973a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404211713370971-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b3f6e1d7e5f1ed75fe48752d5ec8cb67b2cc54ca20c2f2caf295ed5089db2a39
MD5 ccccb406abdaa47bc3c8dc6cdef8d2b5
BLAKE2b-256 e8d73caf227774dc76fad9d81e9144d20c5c7818bda3a3dd18c1e05d0fc4a92a

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