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

pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp39-cp39-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 53b0e12323e72cc44075b20090d2d112590d44fa0100e8e5639169e9041b9201
MD5 b9d920126a70600de3df17c1bd2242bd
BLAKE2b-256 c83fe6ca9d33ee1121640a47cdd5d55d1be36cb33775394ee587ee2ae1f2b721

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c1139993ab45deaa6d39625d0b13025b3e942860f5f8bcb2c8676c7cee6fa086
MD5 a9114ab48843c22f61bd8cda25c7267d
BLAKE2b-256 7f63e6188d09bc1fc051637e9a3ca53ce287c202007201097c393c5adcf84d37

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 559114198cb808b3358d11b3875459528d05a1401b8bdaa691ba3d5ca947b179
MD5 2cab75d1da7850e40abb4eb084bd5bfd
BLAKE2b-256 f68e365303a1b7084eb66b5c84fe8fd899938193fee34119d0a9603300a441e0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 14e962395d91873e1bfd1357dcbd8a3e98e1b3f59e2b711a8c1a6f6f0686c600
MD5 17f7319c54422cc308c15c9bce7e8383
BLAKE2b-256 307899c887b5eef6957e001235f4f91e5bbb5f9b8ada410481e562daf059f1b8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 793d07b1cda73c9c4bccbca3cf8cfa348f538ee830497959997bc126f9f5ebcb
MD5 dfe59d3cff9cccc87541be6242642565
BLAKE2b-256 bd26af8b9a10a822fc4561a05dc185b3fc0a010fd9215f0f31c44db10e2de0f7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 31cd18283482ba65649c8a7a71fb7a5152bd67a500cb22e2b4c49251425a7629
MD5 cafbc14dc3170763b91ad4b28c571c16
BLAKE2b-256 c21276949775946a6bee5a89c59d0e1d5d3dc997a67aa5007c9c40a54ff44ee1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 da2aece5d0d5cd1d4dddf2656368ad65636877a9b8800ec1339cf2c38352b908
MD5 5ceb2426466d4371473a78406d4ca38c
BLAKE2b-256 7b5ae56fe305e7044813886d834dab0d61fbff2fe15529dd8d30a7b0fa2f986e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 34929e98be6729ac32db7430f90e8a55dfeff30459930832ab32c7a49752b3c3
MD5 0ce6ebb052acabf473e8e55e4d5a3f37
BLAKE2b-256 8012841d147603871cfbea5fa40206bc0596154c0e1b30c1793b612ca9efcf8a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a637b5e2c82510dd7eb2a260462f624e259e86bc27467691a9382dd482b5482f
MD5 b8a710d11e483577725a56b425a4ca35
BLAKE2b-256 7eb4d1412e3fa7e44c792d8f66d3f72b3b3b6a8cd072e169ac50b1e24057ccb9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c2a9859c5d113297ac91661ac7c7fe87e396036530f667f7f186e10f9e7cbe00
MD5 0c50554e86a99b7f93fc635f30f6b6c3
BLAKE2b-256 49f8f360729c96dfaf3e538dec7d7cd091a6dd2173a0a7374c70df9590d14781

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 276dc41f33fefd0d28cdabee3db2607569b165e51389c5025ec2fb948a307f51
MD5 a5111c8dad34e62e853feb49b08307f2
BLAKE2b-256 8232e384372b388d1cec0feba49150e5bdfe6f13e8908023661f00a445420e0c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0dff3aeb8a0a5bdcbb2a4c77f41f84ca5b4e9270063df7f026343486ed61f9cb
MD5 3c0573064808d467109a5553f341f1c8
BLAKE2b-256 5eafed31f727b19992aea4eeafb347e3804d3d29a9056cb495b371484ed1a6cc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c5d832d3c7e917be815d3301a4b76f6c8b740be01e652c2dd19cfc68828ba128
MD5 831bc0b8a9408d6cf13cbed5af502e97
BLAKE2b-256 fdaf3db85c986d6894437056de44d1371db6713986f1c4a23e4f627162fdd707

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d543b4e3bade92d91f3426f9a611fe4c59350c5c3a53d5717f82a5dd2191c751
MD5 f6dde6a726be7bf25f72dcc7726d2a42
BLAKE2b-256 c6e2ebf3945efed71fa91c17087b645f51e0b817cc21b992dd50c335e98d5cf0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ec5b6a608e7bbd8fc5161cf317de72ea5eb3a9bfd63e6942959626f8e8cf3495
MD5 bbd9913d031b8d7f22694c3e5faafbd8
BLAKE2b-256 999276af2d1e0a7a69c101d5705409b71cbca4efc59d344135763cf24749af6a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 1d9ed1f03b7a5e88492500a1fe00f503413f3e34513fe54cbb004986f728cda7
MD5 600e49e06dfcfe8a56bc428275bcd10a
BLAKE2b-256 93a565b0cc253902133baf309c6a6d248a25ada0759b267b193c1c0976df0023

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 44871732c796abe7e4897ccb4d904e0d0f670b60d038ed139c56e368e7ffed91
MD5 c0f0426526e3b78ee8a06713d113a03f
BLAKE2b-256 749eca3c5d2a0dd89d18c995baacb07959f9543e26257164f7f2ee2a272146dd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ddc62f44a6fc06557cfa3a7229300fb4ff823a7d058e49c560266f5eb17fc764
MD5 aa41e73b6bda342dcee549f1feb8f3cd
BLAKE2b-256 15abe45fab1de209ed865a1511d55fa437452f11014231b6c82710cb4aeff919

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cfc1dd03d6bd77a17dac74d55f9930be470f2aa55322bea2a05046213540052d
MD5 e083a01f2ed7ec04774dd8cc34d7e6cd
BLAKE2b-256 e4d816e91547666b0a3f1f40bd33faa91cc06d43f4bbdfd4eb27ae8377d227fa

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407021719384100-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c047d78ae28fd7f4fee7b89bf1a79011949523cdc8a0bd145f6a69bf3a410d54
MD5 b4a609a1c56ad6170b7319b9502c662f
BLAKE2b-256 b59c35613d15ffef1c77fdb599e76b5b13dcedd37f0962ce52d0252214e2be3f

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