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

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pyAgrum_nightly-1.14.0.9.dev202406161718113029-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.14.0.9.dev202406161718113029-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 162becafd5dfa2b4ed606f03624cac29e7837efd96c2544e3861c2133e38020b
MD5 2dad637115dc3f1f6d3ea16775f2378c
BLAKE2b-256 c36ef5650267a643fe94649c0944da3ee2b3eaa319ba1f5cfdd79e190c3078ea

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 75ca0fa5bf5252b331117aab374a07ede7ac3603848e0cd6c2716311698cbd69
MD5 fff71d3749cdc3397f9b02430253e7d7
BLAKE2b-256 f28ceabe82ba4321d0c2dcdc9876a235abf9d25af5d43c1754e120f748656204

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 68ca30bdaa5e220474ba5beed8048b901e8af4861461cb578b6310e47484f8e0
MD5 8735e1e74dd03fdd7ea3b5e1c80d2a79
BLAKE2b-256 2e90e0ad3fd3be7b6a47601d5b6104088ef8c6092c65e328aad73a287e90f33e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f7633e2a3015ed4768726c5ac085d2111132ee1a6891b379f1b828457a011ac6
MD5 4824471505cbb61c63360027474ba7a3
BLAKE2b-256 a1997415559030ed4eadf8f33f8c9ce76cf242a493ffaf19e608a004a6b7c89b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d651cdc55be6a7e0444c72d86a70cdb30a5ef5fdaf0f036a4e1c0fb3a7e17f1c
MD5 0d5a25345f92f69c6f212a8928e4e2f8
BLAKE2b-256 2d8278a9a5ef50120f4e539c620bdd80f2acb477cbeb9709cfa62a2b9f6d79f2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 875356080484927fd41aee5e8e0380046e6eb39108c4f05653a0534bcb5b50cf
MD5 294f9bdfc2d2ce4b28714efe9191bef8
BLAKE2b-256 08c3d02f0a2826eb8ffee25552050255fffcc4eff4761ce497c9f90da7f80598

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3412cf6ef6c2bf02a2fc1d7c9702a4ef43c415f746d8e31250edac9ac15b2ab8
MD5 c7f28cfe32c5f0f8ceb5479817e9fd51
BLAKE2b-256 b1156353ac232938efb8a3b8d73f9b2fd27a8a6f8c6cbda3429ebaa742aa758b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 440dbe8bf4f87b141e76622169f83ad50c41b166d853d37077b241f78318af82
MD5 9d740cd11f875f4cc5b1bcaccc555501
BLAKE2b-256 9dc6a30c6bd45785f403bb1fd461d06af10d909878f753b771fa06118e09f306

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 34a54b5551d3bd577a23c1a2b83464e49372a6dbf05e65058f79430f798c6026
MD5 6a3f63e7e71f410d0dca3118b4080b47
BLAKE2b-256 1f5f1b4002ff0aea8884a0305ad757bfbcea44136ead38330027e22df53e65bf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d81a51868ef89bb51ab8c974785a020ea675e5900655e073616253563220be05
MD5 5fa106f0dea3dc1eb3c75fddaf5225bd
BLAKE2b-256 51818688335296f161b1b0c8dc2584d064ab9aec93db42c309268149d63e901a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 2e5689a7703e0a161bbabbd908bac3cfbe4e4fd110ed9339a00df164a30054ef
MD5 3fa487e91fcadcc80c3449112c08aadc
BLAKE2b-256 ebc3d562f43cf2c4319eb3f718e9a47cb002992158b06073ce2679937a049df2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b9c0e732e25f2429d955c35895424c14245ddd27053eac76f112c1c618adf0ba
MD5 2f25a86fdcc866a3966a1a37bf01a1d3
BLAKE2b-256 8fd7efb29c57b15e4db2851c3ba2fd2ade8cdfc2a2957e124a1b1a17d197778a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f859f35d8a0ab9d6312fd65e6f74b616e32d8cadd347ef47be204a9ee7d27f65
MD5 bfbd0ad48aaf9dc0c9d25d6ddab53262
BLAKE2b-256 fc4fc75ebc98b28e7f95dee99eb275e500d9d252b5cd5c7d2c5f7b8d507f0943

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9ab9003fa1565dc3e3023989c6fcdf93214b00570a15c77877f762c97f518eb4
MD5 1fd4c44a6c4be655bed9212e8f457c1f
BLAKE2b-256 a1aad27a89c9c00f18d875709f2f78625927d3c3054380e2771db4ab895b1313

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0b0854717afd4dc24b54ed251d3473db570ee4abcd71151e35708110af9d5395
MD5 e85334c62b36395cde0de28d1dff12f1
BLAKE2b-256 309c3701dc140c6cb533e92b56da6aa0ed5e2ca553c1485c2afeebdd8437e4a9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 25ee675f8ef4983e7916098f30d75cd6f773e218b28d5fc1e9367265e78d813d
MD5 b0825158b497f4c6adf3258e37109f77
BLAKE2b-256 1afcc1b43703d4f50fce1639bec0a92b70030969daedb2122e17883cb9eabae8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 43698cdcfcaa509a3b39a6762f5e79bce67f303c6f4893d938945888173433f5
MD5 722cba39f3b6f3e0667fc318654ffa25
BLAKE2b-256 3fe5e7109fd35a6690e200cec0b3ca86a32e4ea2d57c0732a1be12983d997043

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 cba75ec105a7891e78457a9e947bb664464fab9c15719952f492f2276ee720de
MD5 b4ab213258b7af2d980245a33db11806
BLAKE2b-256 af0d9c5f9f51a9e47e3cbeab87578e6d48e805dd2eb0628faf2e61b534b0352f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 edd94c839f170f4ae4dd18afe4200f9c315f8a8f34ab1392abf3224cb1d42a94
MD5 b5b3313bd76a02ce541bcaa154cd617c
BLAKE2b-256 be981e6a59305ee051d7091787569e105de1d0025e5aa1ee2b41b5a8d73df4e2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406161718113029-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3fede2bd08c59af852e8a640ba45c0bab7ce64e1d133db3b1fa42312c25032b1
MD5 2fd8b39408bbc514f20146168dd5577e
BLAKE2b-256 8c66cb91ee0deb8aeba2e66024a8c9194a07c9f5a270b1ea6c53a15a828f9c2a

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