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

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.13.0.dev202403291711457924-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.0.dev202403291711457924-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.0.dev202403291711457924-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.13.0.dev202403291711457924-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.0.dev202403291711457924-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.0.dev202403291711457924-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.13.0.dev202403291711457924-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.0.dev202403291711457924-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.0.dev202403291711457924-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.13.0.dev202403291711457924-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.0.dev202403291711457924-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.0.dev202403291711457924-cp38-cp38-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.13.0.dev202403291711457924-cp38-cp38-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.0.dev202403291711457924-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.0.dev202403291711457924-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403291711457924-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ff445c297c01d0b267e484cb59393442d3c785e5e882008dc375e7c89a0bb1f6
MD5 422f1ee47757bf7465b193736f316f3a
BLAKE2b-256 5d3ba528c70279ea3fb7e19c84bd569cc572d5e799be3cacaa3316dfc9156b47

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403291711457924-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403291711457924-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cdd4c3840b0542842b328b941b0733e2bb70e4cfc4d4990389f6c5880a5497e4
MD5 5866eb325019c8bbe2bdbdd55d2b01a7
BLAKE2b-256 b3d5ee319f80e628bbdd9d5f8ac960a7365c32db1c10ea20a26993bda709ec5b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403291711457924-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403291711457924-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 86ac8802f952149d2eaa4539d669da9901c364120f263f2690865d7408a4eba5
MD5 6f47e4d8bd90b047f75044822ab36ccd
BLAKE2b-256 41c88c7cca94962cd6a644ad5043947502b95d820e0fab090e4cb1ebf4ecfe4b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403291711457924-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403291711457924-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 70bdc9127ab3b87a008f65db8289dd5441e93ae85f5325a0a9a8c8a05938da3d
MD5 047c46a996df06bc11355ea8d159509e
BLAKE2b-256 a28dafc658b10b39fc1eac86aca59b2fa3bb8d3c53ffddd604480e2d437d42c2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403291711457924-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403291711457924-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 57cb157a8db18f46febfc60cf91870c59392fffcef48337b9291d844a700010e
MD5 911675151857eb6433946bd8967ac25d
BLAKE2b-256 919640b4da9bf12fcbbbc355c425b9704c02681605859b46d46ac531ecf6a063

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403291711457924-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403291711457924-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a908a90de255be6d86ceb593504aa84e9f5a48825502496f0e4f36db4761cc6f
MD5 712e3fcfbd0ce079e3138cf360228bee
BLAKE2b-256 39bcc9eca3cefec10f0a77392ce1ee0e661e3a5d66ba4255542a5b0f4f0afa78

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403291711457924-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403291711457924-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ce8ce32590dbfc131a10527839cda4716d082dfe6bee45a9b5c404d29ef366a9
MD5 035aee0dead460ad8af2a4251067d6f4
BLAKE2b-256 f6b292c6e857916d925df2508add733f22677daeb9b43ace62a67ec3ed45ceef

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403291711457924-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403291711457924-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e1605fceda44a63d233e8553817891bac8790e0f87e2aa314f7572b3a11fab5b
MD5 1776e0ad4f2a115b2f074c4459952506
BLAKE2b-256 ec4d03ee2ffa1dfd3ed745da2e41bfc15cee5440be54f063e63bb428bc6dced8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403291711457924-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403291711457924-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9e07a9f70b3013608627efa9d6e2751f7b268292fe5dde7d4b085270a910c9ed
MD5 3c07bdafdacb081a0216fb6d259e4e0c
BLAKE2b-256 5ffc6129aac74249108963598385541829f5f8aa128b7466f60bae8fcce5cdb3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403291711457924-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403291711457924-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 859d8d374dba49b875663e42f9121ec19269db66cc41a97094ac8d5dd38cfb38
MD5 2060a9af25b592f740bb5924b0828988
BLAKE2b-256 275264754e66b3bce4003668bb184be99b5a9366aa2016617b52c53fa9d2ef91

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403291711457924-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403291711457924-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 aa0aa939e8dcb3553d29dcc2767eaa0a9c6f6a665a788e0c97ba4bac51f3ef4a
MD5 8b189d607b5fbdc6c5273dce9177eec0
BLAKE2b-256 9d9e8ad3b3bc54bafc526f1bad8c5f429e0dd10f75b1e40c1f81e575fd319d65

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403291711457924-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403291711457924-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8a4a3e8cf4238ebd102fd499b77b6f703a171f4f9ba010735b3dbbd8ac0bad38
MD5 04f231c3eb47144e5a97d6bb966cdea2
BLAKE2b-256 b922fd16cf89f4153ae58501a7888ff1632c8f5c03ae095333a49147544d3926

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403291711457924-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403291711457924-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8b0f99895f869a520a9adab5345d97db32049b9605bf20a89825d1bcdc1ec441
MD5 881a0b973ca47c0925ed5454ee46f6d6
BLAKE2b-256 0f1e693b57594ebc786c1954cf70d75b2ffbc0dfd11bfb5a2f2cb27b1d371f5a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403291711457924-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403291711457924-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bc030c43af70be48585ea1fe703090c6b044493ab589721a2a96b3882068beb4
MD5 21de3e52e084e1e1e08ee8e8cf1b6700
BLAKE2b-256 09a717710339d4d13b28afadbf0c699290ce882076afc6ed32cae607ca496572

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403291711457924-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403291711457924-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c5e5ef27a6c09b4d7c1b5ebd922f9f3337695e80a4bc4e95f51a95e2758b9e24
MD5 43699f2fc11d44ddf7a7e059127b2059
BLAKE2b-256 5eb0a592af220ab0b6d8bac6f017e6f939687b138a009f5e9a960be2a3164fe7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403291711457924-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403291711457924-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 c42816f4b3acbdaac8dbeea4c202700a2332cadb035072c8e568a5e3abe03e27
MD5 359d45b864139aa068be6b27c823e709
BLAKE2b-256 626d735f4f823240d3001bef30c01ddf19943096281186fcaf058a12028489c9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403291711457924-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403291711457924-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f51181c158e872c49aa022fabb247799b275f15a5a32c36fc98c7a855bcf3b71
MD5 0d4f7986845e3a0fec3d977a8de93741
BLAKE2b-256 e2c992a1bf14e6852bcac64c17729c67e0993d5eb264e50c5858865b92da755e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403291711457924-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403291711457924-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 02c3c088b4ba4b70b61a952ec1cce1beedd01491db57811dd3d815e2375040c7
MD5 e841d894a04620fb74a98a90757d169f
BLAKE2b-256 9355463b1efb7413276cd427f25a21bd7810433807fc3fa252b2e351fce9464c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403291711457924-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403291711457924-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 561546fc6c14abc85c1d261bdebf7acedaa28b9fff5c1848786b089fe189a154
MD5 5755d510f8b17f97c78c85e8720e15b1
BLAKE2b-256 88d974a29c7ea4687aac4c8ddb5f5b4faebaaecaebe916d8bcc7745f23eb303f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403291711457924-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403291711457924-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 898893dad40a23dca4ccd18ec58a879de75d56fcc0f30e36ece90d75e500dba8
MD5 f108282dbef7b5b64ef0206ac9810f11
BLAKE2b-256 0672212f4e5f7398f2f03922c177c554c8609e5d983fa0ca3b37b8131ab81e20

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403291711457924-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403291711457924-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 691c752fa91cb48945e3396c7eea635c97d7a1017956b82d5b9557bc2b06fa83
MD5 936bc47daa97b3571a77073268d752f1
BLAKE2b-256 912e54b5c2ac7438595d5233f02ba563d785fbdb6d53835dea305ac374df3e88

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403291711457924-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403291711457924-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5bb26c06ae0087e5bcf8fe9162c4900c85cff5f34995281cd615722859772525
MD5 b480675fc80070a52eb78d4d889976d3
BLAKE2b-256 747aa6f8ad79977b706fc3e65d5c99cbaea0bd133cceb3083779bdb638af56f6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403291711457924-cp38-cp38-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403291711457924-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2b287a299f9d7d3b748375ed3abce57a32139081fefd5158ae43a5f7ba6bee7f
MD5 7126009fe6fac55793321fc1a5948290
BLAKE2b-256 ad6b10f2be46060390d5b663b6aded8e30c7500a6b7f2d7c2d6d21da72ae9e77

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403291711457924-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403291711457924-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c485e1b2aa3cf2474d7eb9b4e2d7e7b09f884f8506d39354d37235b8c8075da2
MD5 6b5e82af3e728eed765f78ee196a2c5f
BLAKE2b-256 8edeaaa1ec3a5a0af51624a2122c12386f647344b9f0aeef739cab6fe778c31f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403291711457924-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403291711457924-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2668994cefd5087cfe5df00a0566b3b2290ef6d7b720934b37351343ec26ac94
MD5 39e24e1c1a44bad71b647e4131961e09
BLAKE2b-256 899c877fc60b6e8500904e79742316e529bee107c3ee8908b108000cfa80485e

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