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

Uploaded CPython 3.13 Windows x86-64

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

Uploaded CPython 3.13 macOS 11.0+ ARM64

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

Uploaded CPython 3.13 macOS 10.13+ x86-64

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

Uploaded CPython 3.12 Windows x86-64

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

Uploaded CPython 3.12 macOS 11.0+ ARM64

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

Uploaded CPython 3.12 macOS 10.9+ x86-64

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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.11 macOS 11.0+ ARM64

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

Uploaded CPython 3.11 macOS 10.9+ x86-64

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

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.10 macOS 11.0+ ARM64

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

Uploaded CPython 3.10 macOS 10.9+ x86-64

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411211731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 ef85621355cfa6597372b42dd953858dfdcf037a8843057af0d4c7de22e17166
MD5 1ba04e740071c8de7d08073a7772fe40
BLAKE2b-256 7c5462a7aeef41e938afafc9e2975d91c3facaed734ce37e0547e933b64c5c6c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411211731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 22eea47e1a638403e75cde3f3af2a5cfb8d7dc6687fe720cc41518166d13f74b
MD5 0f7ef5f930cb441faf3677e356b5699d
BLAKE2b-256 afc9be9ef7307a0983d040be5e3fca830f861d554411360c5a20bf7d93dd712e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411211731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 eb0eb79531ff0e7ea49a397e4a9089aa0a7d90227f8f0592c80c95c50ee98719
MD5 c55cd4bef0c8c09eb9f9465c58ddfdd3
BLAKE2b-256 9590c975d921df4ddd0ffe773f48b939b595cb64c4977e0f4f99666942c2af61

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411211731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9deda7aaa2794654c5bb1d534f58f610a766d591a08c446b24ca55cc8ac1ca86
MD5 7511dc2ae1c0c1b8b3df92444e719886
BLAKE2b-256 0e5f07b582ca2166865eefe2b3ced739283e4429890fc2936794b5258c1d9c92

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411211731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 7c077ee3fb936812a58a4483446f55dc100aa0dfe75ae940f5f8c1e833f62a57
MD5 c7359316cb9f1cf27757f7037ae1ed18
BLAKE2b-256 d661585efb5fc06eb8eb63bd275fc70e48af535e6482f803faecec212bf0f84c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411211731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ed1dd82af095d781b4b993c4b2d65a4a40aad60a8b48ea041e3081f2186bd52d
MD5 7ceb2a9caad44ee4d712f56322a2bb67
BLAKE2b-256 33b79c255c306a28e1d507068064d9a845a94d18ea2957505e4e52245b8e3e88

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411211731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9b3d0b8d71c87bb44ee2fe13b120124bf605e78053ef5d33b4f239c17ed92ac9
MD5 1718466fbe27fa8dbbd83c8b2e81c7ab
BLAKE2b-256 24ff3ec325046e34d3740aa19bad50508e22fcffec044c8b36f933cfdd88e706

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411211731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 676968cd62248421d92d2131ccb7c372ee79e477f431f771e993297649bedf99
MD5 2ccd9edd080eee9d4e2bdd603e99b1e8
BLAKE2b-256 5d8ef3c719d1a680d7af3869c7ab638423208e5ffcef1351c1c7fceff8b45e67

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411211731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4ab07b766562dbca0255675c7c65ee8660b25d13c8cef1ae18afe8199ceb1e1b
MD5 1467a572871caf484a563a904cc284e4
BLAKE2b-256 4472c21542ceaa09041ce5df3298a81d99c8b9724ad111f51dd6b039aaefe965

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411211731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 de28d762c5b243b6358de9560c202703c1f14b41e9d372d07d7d2415e8c9cd02
MD5 fbeede0ff1f45ff0778feea46aa9e2dc
BLAKE2b-256 67b27b3a351325a22c46bacbbe93bcffc43c9aad6eebeaa384bd585b57da3c13

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411211731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 4d8009281c45fe58d9f8ec68ebe4cbee1344bd2148f120bb9939130ce9e30a66
MD5 5cc893a513b841934b1a5012fea8fe3b
BLAKE2b-256 ff3821de5e1d9116c013656fc453bfbfd5e98aea179f5a9e0faab33c7dd0af07

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411211731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 355aab9dd45558ae2e95cdde2fc66116e7f732b9e20cc989913b548784934f81
MD5 c0516148dc23a0e115bbae646d89b34c
BLAKE2b-256 3ed0e3807bca3516ba9d95679edc7f62c4e37b7e263bddbf829476a01a271d26

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411211731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b9f9779c824329e2b92164b5f7a70edd37a3fbd997d9b1013351c2370af6e06d
MD5 4903a8f66041f9df09693f374a5e03d2
BLAKE2b-256 292a289f8237d3c29b2c228ab09f8036e103ba685e9edaf977f0f50c4585c676

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411211731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 977a575c7fdac7bfa37afeb4f05e4f5f53ab9b9bbb49971c3f526c318a1e57f2
MD5 cd4adaa41cf0b44ca6a6ddb449f5128a
BLAKE2b-256 d8133a8e322cda30c7b7a1cd2144b11abde13f74e7fccda8502911b88d092f61

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411211731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8c4f46ff296212dc137fb76ee22a6a68430f29af704d89a067b8d227ae777148
MD5 eb69c53f8d575447f880fb53ed809551
BLAKE2b-256 c3a73d54d20ec8c52f5f71f2d513e87beeb728a6849e0b96938058b19475350e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411211731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e89b5bde7eb96415be168a8213bec21eb5dd2b8e03b8f4e14e147328222be250
MD5 daeb48f5d6ee157d45e780a45d711e75
BLAKE2b-256 a3482c04ffd67024c1ba7b9059f1fc9dc697ffbce0442a3084f43d9b53907908

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411211731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 97fce08744f8ec026372eff18f1656b884ee0417a7ba9d60563420cfe3e78829
MD5 92304a2f6258f89008d892a095945ffd
BLAKE2b-256 d93b864d690b9674d3f3e93fa1adeb67f3862463ce31bb99b34d2c1a7818b102

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411211731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d0c03171bbce1deeb58f2c66725fefd22eb5574569b69f412a183d517f1bfbc9
MD5 64c41f8f7be226a8cf4b953051a41da2
BLAKE2b-256 6f3460c6d922faf025b0cf6831bda3225a468e8795c2d45b745e3abb8967009e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411211731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5d176ae8a491769fccb08227dbace98bd4fb7afd4325569515f1850fe3010cd3
MD5 ec529c202f4779ece9be93a6543c94e3
BLAKE2b-256 48025269fbd27edd5c5361d6287f843a5d1e916071db9f32008fa7c04813c169

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411211731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 36d257c962d6bbb60eb54c5315073185a9b5bccc0c1e960eabe093d7e4284fee
MD5 8f7191e66dd9214cb7de2da491e1fa76
BLAKE2b-256 72515607dd5c6e12363ace91cb2b55647a94e9f7f69825ff3c319cd454692cac

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