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

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp39-cp39-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp39-cp39-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 dd6bc80c2879b7acdb8599c355d824bbbb3ce6637e369bc7c5aa761c59386405
MD5 10b86aa97631dd2e6d0e49cc9f6f6a85
BLAKE2b-256 819ec2dbceb1f132f1815704bfde32229b5de7a4c3966b81386336bb1b75166d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 056e093a6caac78b2f22e80e4bf53483359e4e0862ddedf0fe413103c3383526
MD5 a21e891b91d642c2c18513a08cb6ba4d
BLAKE2b-256 68ecacb3cf242a69c6ea4f5b8ee635b185ffdc1f63da21031daa70e1f0df762e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7bac8b35c2059c276cfa8e8bcc3b5b975b8887520a1f3e20247b010be7ea9b89
MD5 12138a9466f7ef5b9a9dd346393e8565
BLAKE2b-256 b6c9155dbc67620d1fe1798446cbc77350ba0ec93afd4562d1d2c77ea101a9a4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 03e9589a0667df3b6bdf0b9a5064d58695c21319a82e4a08c4a050a75f47ca50
MD5 bc03e8f9522f7c8c91b4125c57e69907
BLAKE2b-256 03740082acdbe4f1cee2ed823f9e280008cb98cf6e0b0a2f280ddee4dfd4d494

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5a892ccf639c7d35404a3f6c96d8aa6e6616d251d79f74b6b6f4be2de0bd2606
MD5 13a16ff78c344ecdcf36e937ad1b5e6d
BLAKE2b-256 4f82130b63b3cd99df4fd71e92af520d76b14b79f1348d2c916760ad5b3c9056

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8f81a0b56665f41e1308127fe21150d4848ea3738d927c169ce2641901bc973c
MD5 42f1eefa8bb99f0e96ee64291f25be37
BLAKE2b-256 0dfa5cf599d16c04b9ebd7f7b758f5e3cd257c60f19d429f602db84b5a8c7308

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5813be3057ac89a4896ac79c701cafe43a1a6485bc5f570f7aa04051c7a34c4d
MD5 32f7ce5b20e47187e1ec6bf899dbccaa
BLAKE2b-256 3fa25278c1c961f1570bd2468e856dd43dc7ee12907631eba9a0a9d2bf21e427

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1514154aa0a5d5884cf15af3614b7b64b8c0e3cdb760c8cbd9be3a3ba5f36295
MD5 1a73ad293c025f84538b52c2553f4263
BLAKE2b-256 c7eb1d9ca816596c27c93946d7996e92a62dade1165ea74b32e82c164949476c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f56942240bbf5293b021482c610a2dc30aed2e5f64fc33ecd70319167f14c47d
MD5 4a5499ef3fe21757b4064430a7836327
BLAKE2b-256 26fc445f0756ce9ec34fa5172e52c5cc0e3c03aeea40546fcf7c404f0462c3af

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 efae533cd825ef07ad62855261a7d1d771124c266f3117fc655d4cad6d414ea3
MD5 1b89e89386f1c436d8cda29f5ef60865
BLAKE2b-256 342c53cab752eefe5a6e78b8b6d5b4f6b5518630ec0991a739191957e1c853a9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 fe320a14ca23e2a0eaee7995edb55a24445631559ab1075037308cf4caac1a9e
MD5 ec8da4744b9756f654e10c2510d3c5f6
BLAKE2b-256 4af019f3212d7fe46112fb2f56955b6a9eb3f51180f15da2f7930a88201b858e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 66f4529cc1245e95b21293c60060d182ad5f4f6470a63481994f09b3717ca19b
MD5 28213fe0cd2db31f6b7fe865b52a6c43
BLAKE2b-256 1cd6f259e88e03a5b7a69840c0dfd030551e81370f6f9ad60a8a9397dd1ba4da

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8c2c388975617d9b075b7d4961c8b7d051ed432cbe0d53c457865d9c7879d63e
MD5 4066f31daa64d84c7ac801df0aa1ebd8
BLAKE2b-256 b1e700a8bf703afc01ad24dd339654338d8f079627ac21edabab5a6ea9c29e9e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e9aeb3a1442bb96c5fae62eafef8b3bb45873dfbbf2c59263c2af5812597d114
MD5 da682887aa0c5232aa261daf907d7404
BLAKE2b-256 3b41c60acc7a7a48b684879c6b52cd866f4889b977562f52ee455738d27dcdbd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bd22890fd1dbe7ad9ca2548c6c19c1627c8333136fb329bd7849e7fd4aefeef6
MD5 78fa3ca78fc6b9deab2b11b1cc2c4a61
BLAKE2b-256 79a82ec646203c2961a4a4b9c08c26a9d5765aaf3464fef8fd7f1373723aeb32

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 06a0ebf2507db4ee3f931dc1eac5606e7aca78187dea075e9e778f9dc87f9d5e
MD5 944c9eaac1fd65af481e5b5205f52b95
BLAKE2b-256 07db483a1f9d27cc5f609198bf19719f418282b0eda03a87375a9fedc4687dae

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fa47268aae3bb00bdb2c0d2bfd83339c777e2c19ebf33486fcd6f6a3a1836fca
MD5 8234e71d57b75ec070669373ab0421aa
BLAKE2b-256 6f8a93f56b67740587fbfb9901b2e629254699ca936d569e7d77360a3b869de3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a5a69860c85deda1e3947f56d58c6bd07381298ad0e8f7acfdd4be73c32e994b
MD5 20e5bddf8bedea6eacda693068b817a2
BLAKE2b-256 3b57540b69199f8f4375b19c8f30bf6abc73f569e40c38bf2c009b7330ca15a2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c0931792d43a5edff81c9412d58eab3248446035f7434f379873b18d35f268e7
MD5 76f3b6cb2084ad7845c9315c1cba1d45
BLAKE2b-256 712e99daae420da105fca232321dc0e825da12e4df37a259f0d8a6d23cd35dd9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408031721169663-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b8e135fd601be0eff9c5f309c3a30401ccfcda4fb009b903ca62685c867b4694
MD5 4d22211ab79b6de3b4932725172ba6c2
BLAKE2b-256 3717a48acac00876bbefc08ca1a185ddeef011f2d9cd571da3429ede6a5c7baa

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