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

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.2.dev202501211731932516-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501211731932516-cp313-cp313-macosx_10_13_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pyAgrum_nightly-1.17.2.dev202501211731932516-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.2.dev202501211731932516-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501211731932516-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.dev202501211731932516-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.2.dev202501211731932516-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501211731932516-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.dev202501211731932516-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.dev202501211731932516-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501211731932516-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501211731932516-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501211731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 c280129327aa10dfbc5a59b919653d3f8d98766c9e132174914d32321731d40c
MD5 c3720dddcb6fe2d8585a417f58711f39
BLAKE2b-256 274ac6d9250e0324fb72af64fa2655e814c4fb0eb77dc2e2a21e14b43c079d42

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501211731932516-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501211731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a76f4df6a3777283aa97a78cc36234982a2936daf2713440796e2c87d096db46
MD5 a907453812d4dd77aee823a8aef16a33
BLAKE2b-256 a6ad755d4076186b8dd23300029e2cc0c13b165590f9e7e24bcacb6354ad9e92

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501211731932516-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501211731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 08428dceaf8bd749bb5405929fb980708d91a5bb3a148ae0dccb99c0ce423eda
MD5 70c8b0a4a53c624777c98ac318f7f2a6
BLAKE2b-256 a42e587840fd00b87cfbe40e206b8de3ddfaa174476ba6a2d0d9ec2f940d66b9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501211731932516-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501211731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b6211060af5217054d11eb96f23d4bea68d00339b53a4072ef98fe2a56c2cbb8
MD5 606d7cee968f77359065ce9737a74817
BLAKE2b-256 52bd0cce74ebf9a3b154dd915fa4916aa7ec1b6ecd8b2c6f67804cf3be15f9f1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501211731932516-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501211731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 f016dc118d9b2d97ddedc6946a07332ced8997372c7d3fd59c43a6ab068e8e4d
MD5 4f1445d3e7d0cd0f2bb3a34b97e37007
BLAKE2b-256 b82b1b4edacfb9c80df4a9f36509bc2bdff4f4657378eb931d0b778c91e7ae14

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501211731932516-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501211731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ea8f0ed865beca0be42bd52b4dccdf0814f6f94430b9d5f24e71617922c33f66
MD5 e50548abcecbf661b63219ea532adfbf
BLAKE2b-256 4040bdd8062bfae750f138745358c7f2aac8925011a7c720c2c381c99d4c8c67

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501211731932516-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501211731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7ab6dd530f687bb0bd4044ca4706bc19e42ba18987c9c90b3c0751c536568be6
MD5 fa799dbaa00dfb8af89c1c28559593da
BLAKE2b-256 1edb1b6a38adf1167fa652f0bfbed7e95403e2e24ad89b29f45f1e8632865b9d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501211731932516-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501211731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c344f0b26aeb81f138b94659de121ec4bad336bdbd7e59ae2befda60b76ebce9
MD5 6b16164491724545a1f2430c7e450d6e
BLAKE2b-256 c68eb709b5cc16c77b8418cf4a94442a06bc8a03669cd23df30e5cb04f129409

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501211731932516-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501211731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 523a3958f8d049fdb30314feb2f1e2a74b02683282b91f5f168c836d88e6fbf5
MD5 472e465984c2d468cbe724ba625192d0
BLAKE2b-256 50ca04dcd066c28af0e65ab6d88277134763b2305cdb89a68c4a1ce6d17a34dd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501211731932516-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501211731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1e9aa3cb16529bd7398b59520a553cc1e69cebd4e1c10c71b3bebc4556e5d105
MD5 6d0a4bd84612cfd6b6494cc8dab63b71
BLAKE2b-256 ec2f9361eeed89ef6cdd3c2ec7cb106ec62e0e7708c14909da7f7159d4cbf48d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501211731932516-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501211731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5bdc38c9392e18d4ddebb9ee8750445d6620fd042beb05d7a30325afa4e43234
MD5 3cfb2408483d35aa278ab67c573569be
BLAKE2b-256 58e47d6ae8f76bb47873ae29e71a5faf8ac1b43c7e6c8d75f976bb7c451d5250

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501211731932516-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501211731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bc26aa6ac01a49631fa7cc56d4ebc232c74e4dd0fff316f3c89e7869d8e7caf6
MD5 7adbf88e41867bd6edc2a6ab4287a2b1
BLAKE2b-256 9e8742049481b8916b65ba213853a0a147b75fbbc5a9eb5d1489fd1a31192cd9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501211731932516-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501211731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e3fe84c2bf63fb5fd142e1b7a0cccb3e036d0e635e9d0472076ee8091522bb91
MD5 c932a4829f356552d3f5873b47115084
BLAKE2b-256 6ea3c2387b3b066cdc014c34def96713817641aaa52a6d05a958984f6066042f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501211731932516-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501211731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 585671b8a5966b93636a1e0424197515a430b2ecb5f7609d0f9497e208c85427
MD5 e92d5732330bbf2a79e233a3f6d6f662
BLAKE2b-256 7db9ae6f65506b587e723ab4c960f83f91da37afeffecc604ebd5755815354dc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501211731932516-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501211731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e4c0e65afcc0890f7c4723eaa591adc1c64ae5f0baef9175975116d9ce8be3b1
MD5 8be238092df936cabdf7c32b138c7eae
BLAKE2b-256 f70f6e60e5183ac0e8c360e9d5e76ae5b5067a8b8717ebc2b6052db2c869f32f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501211731932516-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501211731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 91d2b6764323eb1592206e70e5e7db5232ec490f74db4448268d3439816a52e3
MD5 4570018752a56e857d2c0bf3f81e2084
BLAKE2b-256 842075815513e29da66509676034de2a47f561994acb987c32a8bc97c4c931b1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501211731932516-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501211731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bfcfeff083388756483385ef1833b3d6884e8598780bd3c396d70c2b2181f69b
MD5 988b70355e1ddba3750a92585d8cfc90
BLAKE2b-256 762d60d982fdb88a6864663076b981bbd4859ed7eeb8c3d1eef0e46c9c70a026

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501211731932516-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501211731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1ee423b87990f74ad178df35b64230b509b11853dfc031cd2726fd022603fa2e
MD5 74bbc404a8043017c5bd6465c6fc74ce
BLAKE2b-256 93c17ae792c4238b9c8f1eb31b676db9c790b6f005e5dfc308f33f21add081ae

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501211731932516-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501211731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fb6d8b1ad455bf8728953cd1cef5fa44d7624e2f88ae9f57ae20c98450b7b404
MD5 7400fc24aea03995ce0113827c59176c
BLAKE2b-256 fdec43f062d05b901e5e85ef5a2a0e598dc5ba796705e07d7de596c0271f4272

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501211731932516-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501211731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 50a00cb18b14a17292a19c24d3d5978978ec0f4cdda57c31cd012d395cdcac23
MD5 838d32b317fb1a1cb6784034cd02e0c3
BLAKE2b-256 927b57cd6daa227352018b3610a9b9a9a36a678bbf5b9916085c47ade1ab6226

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