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

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202406041715182293-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.2.9.dev202406041715182293-cp38-cp38-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202406041715182293-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.2.9.dev202406041715182293-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ed53b5ab56b2e44c6268078b0c00cd736d0f2ae005c6df65df6ffa527e01c55e
MD5 29350774825130a2284de776471b2879
BLAKE2b-256 dfffaacd8bd711d50a76a81b34f690e8baa0945db872bff24cca77fe7dee2e48

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 99a9189be0c7d3dc6767933417300132b6a4fc4c4e4c130a1c58ff007f332a92
MD5 69312f9f37a57cbaf84c245e3af5e8f7
BLAKE2b-256 62150066b0c5920fc017789e3bd411f2e6e872da9df08d5500c5df7f4fcb1dc9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d5905cfe270d4d9fb2c49afe1426754cbc6749e35bf0eb108000a29bdeb40303
MD5 2d6742f0428c3a560d0730139dabcf68
BLAKE2b-256 5c08d4d3573dbf8cc116fe006cb16ad5e5902c60d53d2fdffc4d6199d5fcc01a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 28efb716ab2b5e511ae42c55e2ccee76c74dcefa8987250d30f00be0b1a58f29
MD5 7c78d310ded46496216891c72ad9be85
BLAKE2b-256 cb0ee8649cc528231a560cc8b3544c83e4303122efdb27fac229aa8f85ea387e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 221eab3d350eb33d9b4dc9c4f02685bc06bb268a0ce029c0642d1d15bfd7d5b2
MD5 1a1dd2c5e1682571c6c71a43673eaa80
BLAKE2b-256 8499da89dbf3fe80e3327761268b093d116eeadf4c1e164d7d4534326eafbf37

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e6758e6d1f54cca05a162588ca57dffb58f87386d179eb11bf7d43a4115c6534
MD5 cbcac8f2e1aa572a7c1633b872212ba4
BLAKE2b-256 7aa7f058a49eb1aca49d40b6bdf69ed5ce5273adac891c10649d05498324c0e8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 24514921106ecff7b15247fe85dfb5868889a5868c43489a399db7a78de3650e
MD5 cb8ad2fb5acfbb2d34b4a7d8f108b88d
BLAKE2b-256 7b6fa4da024c2179ba0af94a1c6ba8ac16d61b51f4d7c8f7a44f6c22ef36417f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4386edb0853ab888f432912d7f7ba63e3b888e3b7251da89f8294e25a318c93b
MD5 90b49c1bf82fdfd48bfc3e3b6d7861eb
BLAKE2b-256 98c6739a619ef2766769ce3a809df501489bc4edcb38fef2df74001bfac289f4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3b3b2fc9f4cea8903d80b4c914598ab1daca47112ae6c3792bba6758710e70f0
MD5 c53d0e7464f0757f7f1b56589e98200d
BLAKE2b-256 07bab5a5a95a0432899c89c5a1496b0ad8b68fd8e87ea22fee063d5a20747f3e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 79ca64dc6c04b1439e8e2fc629a782927e8e93d9a6d6f8a65d7cabca55427c90
MD5 df929338ac5d6fa2fd794b3c966dfcd0
BLAKE2b-256 1cdbb1030b9a605b7795637f25ef1aa648b25e11fa4cbba5f3117583e8c317ba

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 50ff92f74a7536a9185e331c3a816129c84865b2b3f39ef63f0f9530d67539a1
MD5 36e648396f6cd7ef680f1050d0d46cf8
BLAKE2b-256 6b0c2cddfd176085dc773900a653a54d8f75d043abda72e0746f0f88653d529f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fce73cd1c8d35ccb56506a40fb9afe08b2b569aca1ffbe3ccb55a4b9d33de178
MD5 e8d7da20968a3309e33474914bb1f97c
BLAKE2b-256 144db61bb20b7e6e25e39a11f153ca936b2e906ea8d9e6650236315e986aad00

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4e12a30fa0f3fcb5c92a61c9d0474d5caee7595a12ba3820d61a04c40eaef9d2
MD5 c0c7a8989293be0c97f0b77d902b3020
BLAKE2b-256 e71f71c7c547062a41c6a81c094acc06eca498bef3a5c182780723f0e1895e63

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5cfa2121a8539374ce568ad51739b60a43acd336583eaf8c49bdcd60c9cdf281
MD5 b5c9e11c908b6fc8879271a8b6bbf84e
BLAKE2b-256 8c0417af26b817e094bd6483542a8299d591af695811a5f3fa74e2a823b91c05

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6165a84a2259d5857263076e9f38d3c74484b8b0bc4a538b44486c209f2a514d
MD5 7062c1ab1066023beb251bebbb06700e
BLAKE2b-256 340097edec917010672e4454b0c3ff2dd29e23bfb812c804b27a90a2fff0c66d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 75368ac8cb240a1e7de5064a739ddc052ce8e3928002ec4e8ac38378a25f1372
MD5 4120ca1906396ed313a8c3b560aaed4d
BLAKE2b-256 dacfe09ebcf299f762f1aab9767f6cc4a7a118d9e3838b4d90ea1a395e3bc4e7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c4c9e752d18952f2fc100762da6260a76c2a4c5dff5cd7c09e3020afda91feaf
MD5 928a8fe9d9d88c060d227c2b8b6848df
BLAKE2b-256 64fe089eaff0eb877cd09496db2654863df7ff8e2f92c8020cbf6a3b4ae05475

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 195d3659493fb9f8689f29d077905eefb883ee8499738b9bfee9398f929ccdd6
MD5 227f25fadbe73a294613d95d80012411
BLAKE2b-256 c1dedb94e6a722de74c490d7532bad0bbaf60f98ce21152e415dd1e2ae0401f1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 67aedb4ecc5d27d23f19510c9eb4729df8423fa574b4649473f55ceab0c50794
MD5 c79d3ac2978da958b76c9f7ed61a9ab6
BLAKE2b-256 72cee0eed5d384720d899dec78d05e363d23d7cca7a92246a909b3db1067d6a4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 341c54b127aab4b2fdf44bc0e8aa12d31a86aec8d995b443ee02aa6d36e12d82
MD5 6550cb626bd2ed915b24420bb0453d4d
BLAKE2b-256 f9a0dce7f40c08826136ff182681123e702e1501b487af3c6dc31b18d779debd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 8e94d37e42db6ad0f0c7d98d0b3ff33ac223d59ee3d0b268d8a64cb0bd1de63c
MD5 44359364aa4d9a81948131e433cbb8c5
BLAKE2b-256 af6b114d5aea4e6db888fb0e9b49ff73dd8c9f34cfba6e9b3add81043ca18698

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5b0bf282eb0fd435801d9f89b48d9f611e1560f5d0ec1200b2ec68f618e142c1
MD5 3452bb0265200c7b39d8db84e2d8ea27
BLAKE2b-256 70975ce43e513c56d4190f57ce6cb42f3d89805a480dd6865dbef67ba0bee306

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp38-cp38-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 db8bd1a685c239e89b175989158bfaa77f31e8012f63b137719ae31c71f4570b
MD5 002e69065b1a4cc75f39a16c75be7dbb
BLAKE2b-256 43e29c0d1438b4b44decb5eaa39546e83b7316c8de86b31e2b1989d2f2df7a55

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 69fd824328e3db29578bd40652871ae8a8bc7f929c9075612f34734d6a21f48b
MD5 b2700f8963723fdbddbef869a5a078fd
BLAKE2b-256 8018a49bf3b8c0c9100aea0cc56570459698b35809a5702ab04f042378b0dc53

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406041715182293-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0eab4497bfa0a579d302864835bbf2d11ee05e529a43233c6e1f9324e7b3c0a9
MD5 ee0ba0e1baa723e1812ea3c9a5cd2100
BLAKE2b-256 bc365cc952ccc92c599393799d56665cf6a33152cfb710e2380078bf1970b1f5

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