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

Uploaded CPython 3.12 Windows x86-64

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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.9 Windows x86-64

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

Uploaded CPython 3.8 Windows x86-64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404191713370971-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 bc34e54c61e559971bd4cb9b3978948d64b90c324d9dd808c42488e4ad97bf81
MD5 8730aad49d0ac02ae6eadd625f2f9ffc
BLAKE2b-256 68a21323085967eb20ec90e90b24a5058b339a63a32b2c0f608a4dc013ca9a43

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404191713370971-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 861b30783e1255bf8ba5c272bc8901b15fbdac0a8a0003393cc214f82bc58036
MD5 75f98fb17ccebcc235586af9c2e2348f
BLAKE2b-256 6ca419e94ffbf74bddb182a341568b7c46c2c401b345ff7b3f6c19ef3f6b22b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404191713370971-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a0983eb64d96b1ddda98bc298409001b1761d8c960ef0fd34a0a04cad791a733
MD5 fb5a3d3a7bc0eb2ab4b78a2e1802e3dc
BLAKE2b-256 d368906ac1dc0aca4e78eb421704c11a185ba218341e02138cc48fc57c15ac81

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404191713370971-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f268ec15588f55f78c8da262bfee2ddc8db6aca82e64eb91eb271d3601f44d24
MD5 420257c1c4a90789eb4bb4e917fdab04
BLAKE2b-256 ca26a3ba19735806992271f3987dcc87c8267a4486d982102b824277e9259c64

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404191713370971-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2a764af66a4107715d89363916a37ca4f2426d4cf1f997155de7f1a486f13826
MD5 784297ad5ccc087407c2e2f8dd114e4b
BLAKE2b-256 22ef3fbda8441627500488e2638974555ebbacf718c1f60316f9c932d71b0ec7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404191713370971-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 bb9a3e45e1f3e2cb61a9a8fd1cec81ad1ca9bf799405f8a31b43c405dec185dc
MD5 45dbe08c2cde1762bafaaaaf04d9194c
BLAKE2b-256 c32befbfb1fba4456961b2cc338170c9f108d87c703d6374d7b35fe1915dfca6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404191713370971-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d5004cf35d2f510301dbb7d84a3eada68bf708b2a32deb74ac400cb93f48887a
MD5 9ff749c1ef4425fdc33652fc378a5db8
BLAKE2b-256 93b3e82026dc16ff2c0610c63f7dcaf2a020806bb78b8a607821cb423d22905f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404191713370971-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3824d05a2f943ad2b6397324229cae987c6d7c35170ec8dfc51e76f361a8458a
MD5 002f9da6d25a0b56be480324398cef26
BLAKE2b-256 21ffe8bd69fae041201be9c59249df1e67a76774e29f50a1132dbfdc5aa5847a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404191713370971-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 672fa3d524c85bf0d984e79c1a6bdf76cf74376c3a9d1aea92a28c89bf722d0f
MD5 f61e8c99326b5af0e6874db487239e6e
BLAKE2b-256 ef3b80215fbbe7bb8179dd3585db9e4503addec8693c3202b86972e243dd04ae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404191713370971-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 493b95118f61ff7d9c8b95afc6094dec7a55f8b91bc6d0c194d1cc076b0b8959
MD5 45c73206bd8cf60250cac63f4752c30b
BLAKE2b-256 f58c1ff0813c24afe63fddef7a7e5d674645a5ac8d2ed489b8d88780c3092cea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404191713370971-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4aa3c5d16dc5a71526058b007cf396494cade63b63da3d9a0f775dff77b19dd7
MD5 461a907ae6759c82236741d3a005a82a
BLAKE2b-256 e702527a558b0ebe93ff60b6eac199404faf27f710b848b4c837730cac889d44

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404191713370971-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6dbc6c3caefef9f7195292655f1701cb6fb8518917b8550e97a58471cb584b6f
MD5 a0a9cf9efe41f192a77d068a45b24272
BLAKE2b-256 48bd6f82b131fc86e1eca0426a553a9074721e71a816f71d0a91528b915374eb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404191713370971-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 495bf94c0985f90fef80f274ecbcc16904f18e8e63b3c083b991fd6f19e4362a
MD5 8988ada39ae928147e26bec867de299d
BLAKE2b-256 2c5f9f12372612febcb3ee6a15045a8867aef0db7bc89b80de18391a0223b3d7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404191713370971-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bc9f5bc0b15b25622467a16d0cbee5f23bb4863daa82bcbe5019884d622f6cf3
MD5 08a82017880a7de87f090c05739f57da
BLAKE2b-256 13320307e10242682467dff7b5efc4dd220e48acaa801f3e6c0a5ba7fcacc39e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404191713370971-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bd7de5e32b0d8eed1396ab1df1230697533563d5300305bbfc4ae79648629bc1
MD5 eb290f7578dd9e6294860cc1cb91f7e0
BLAKE2b-256 48d9892421f5d0a4fd40aa843dafd21d527406befe0d2141af17b05dbba69add

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404191713370971-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 51722284098fd4267998af41ffe5949e70f6ae4955df3c29ced0de53b14cd289
MD5 88d46181533a13421b01fa3f98da6f2b
BLAKE2b-256 974b9a8181487705daa970b32b026b88b8849a74a4a52986db5ccd54fac00aac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404191713370971-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 900794007b1200e2255cf4f8e35610742982ed1575e7ef69db48f417ae69b5ea
MD5 d78e77ab9d52f3f28d2d55e011fd7181
BLAKE2b-256 b2f259fe6343fae185143d793169e05620cc212967276cbd06e45d74e8b497a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404191713370971-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7db6dadeb5484152931d7674713c921f40f98b721c8dba972a7a5b741888426f
MD5 c9a74098ab0aae94e0826cc76e680ea4
BLAKE2b-256 eb034bf4a10ed66b0dba2f767acaebf6fea45b138df84d8fd726892ee63b84c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404191713370971-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6daa46c96f0c24c4fad06e9447ef26dfee4eab681776f9626e6aaa7d4d04be82
MD5 f276643a423b1cb3ded20b1e3b129fdf
BLAKE2b-256 6bf1a56e3a29c4702e6c380c0c8838d9bbe76fee757baacae10ffe922af407db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404191713370971-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8af281259d5f306f0638cc2d3ddc4abd287ae74bf11098ab1c06b36d530fba49
MD5 1d58f8ca3a4ff3c161fb8cf48d1754ee
BLAKE2b-256 fa9a5e0f7daefdfccafe5ccbf736c748e7f4101fee27f346e04c1f687c6995af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404191713370971-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 b0da59f1ac80f2b6316b5e7aa006e175b67f50834996b26fb3d2ab1b8fd65568
MD5 24a946c4da8f788524f45629b67b8b9d
BLAKE2b-256 ec51874f36cf276fd03378ba299c2a1221f37171a8aca33d97f748a92d4965e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404191713370971-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 53c0d93c0ba42cd4d700952568cdbd1e34a9c8822439a2a0c31c21cd379189ea
MD5 7f415d1ad70977a682890f25819fbcfe
BLAKE2b-256 a7c2746b1d6e55707d597bfd78d70338f6efa08db4c6dd17df1e695d3531794e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404191713370971-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 53013a1b726bddde87766509fc11645de038655cb67ada93400cb188474dd20a
MD5 0adace9bcfb0bdc77df5e36557fd3b9a
BLAKE2b-256 83e588b6b1ac4088f8c648744fa0e5b8756ac0f9532df5ebd6e613de65d788e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404191713370971-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 214e84da52f671612be08363f6d63a2ba77fc71a2f507e4cea3fa3686ff3fc64
MD5 f02cbcf5c63570d1cd8c0d7f3c881d5e
BLAKE2b-256 070029d0114c348df4054629c4e41b6ea982d2bc6868071f4d6cbb223fe41f32

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404191713370971-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ab2e82a6203cb1c19449860caf2a74d1b8d590059da20cb4089f460f7706082d
MD5 843362445e4225acb030c371c5a04c63
BLAKE2b-256 31f8597df540de9128f58a13c04c344e463acfab518dcec058b7e717b8b807a3

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