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

Uploaded CPython 3.12 Windows x86-64

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

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202408151721169663-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.15.0.9.dev202408151721169663-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202408151721169663-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.15.0.9.dev202408151721169663-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.10 macOS 11.0+ ARM64

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

Uploaded CPython 3.10 macOS 10.9+ x86-64

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

Uploaded CPython 3.9 Windows x86-64

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

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202408151721169663-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.15.0.9.dev202408151721169663-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408151721169663-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 060be681d5e4b8e8d1dfa36196eabee676d2c86b3c740971d80f564ce7138ddd
MD5 8380fccdc1308b24b1ffa6ddd9f5d85c
BLAKE2b-256 aa34314932c7e2a84bb60e139dfebc6ce59a71fca1ab06ec363941de8766aa54

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408151721169663-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cfed53985e380b54dc54194196da5f8a6b864f6184082ecdb3462cfae9fef18c
MD5 908bc878413b5ad030cb461648ba17c1
BLAKE2b-256 e430f61356a62b95cbd0f03e8df31cde008632ca6a33319add0da5c6c4dfaa84

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408151721169663-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b7ed8966fbeda06679402762cf697ae3a8a8b065c4249e4d58ede56fc5476fbc
MD5 1d702a47e5f7e933fe83ed924b8e7983
BLAKE2b-256 57ab98771542b4d3454fda06852c33b0003d197bda16c33e7bec4d332e16d634

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408151721169663-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 05d771ae4dcfdd8f403b118c4aed88aafbd42b82a50381dadf1336e37ee81ed2
MD5 f00e03af7ef11e5ca87741c0d3cb1251
BLAKE2b-256 018df78eb7ee1d466b56f1edd4b7184f073b6491b021e72e930ea647e611dbb2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408151721169663-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2eb3a2eba9b98461f0974a36a88ca91556dc8a2e0c52e6ab20673c2296828574
MD5 012e2cb4174a032d905aa36ede7e86c8
BLAKE2b-256 e92241c41d889c7ff3816cb0b00edcf2c084bf2df8d4e6ebba57b89f89a23cb1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408151721169663-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 80e36e8f7e0bc697a5b2374bc717e6f71e4ed98957a44e75937dd47ebd45a6cb
MD5 ac257601c810fedd5f8e0236981108c3
BLAKE2b-256 4083aec71c6c72e085708d98dc114a266f095c3b7293420629a72581b8a624e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408151721169663-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b7f6727bf9b8f8e63589787da5189219cd0187e589e603c4a3ab89be3e44099b
MD5 c928d34ae27164a3b01330d73d5de1e4
BLAKE2b-256 4cbeef3dd0fca086d16c9788347515bae9dfcdfcce59b6993e001705d7b8eca5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408151721169663-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f127bad5e2a82af0d71cb189dd80844b491102c3137fec557cef7b05d6aeda13
MD5 0921e51d807a9db2aeb73ae8fcd1d93d
BLAKE2b-256 45ea37cbe6d493410fd1f64120b76d8d703d45db784a50987af821878cf4dbe1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408151721169663-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4079e9c3d84d086404a63a55164f77840399aee6142d80fa661b6f25360d06e3
MD5 ffa38f6d6eae03a38669ca82f38fc7a7
BLAKE2b-256 0b1248443c93c1fea60c4fcff2f88ac45f7135c94fdb8acc1fe5acd0e0c019c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408151721169663-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a0ee910bd8217ab6946e0707619bfc229fafebc2ffe94cff8b33dbfa68f96d44
MD5 1701782a3c63201f020bb048986df23e
BLAKE2b-256 0a12d20d4eeb2d1941cfa105b9a69d706cc61c4fd1e6f3819baaae4c566c09a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408151721169663-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 2865eca4831d919a9ad9c48c1e6532af9ffd96d41cc8b203b3ac7fdef23ef88a
MD5 ae0afc1adf70846bd16c80f15abdd824
BLAKE2b-256 f1a00d6f7b61475484559a57b37a79df9806acf46e8ac6da742971e800880c92

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408151721169663-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 edf3005bf7e952cd5e44c3f9b2c9f21d23287d667b4b445e06d0fee47e73e039
MD5 583b7d89cca74457fc4a1b70efea3e08
BLAKE2b-256 d59e40ef1005f3933668fb2d819db5b60fa904b36dbb7abdd3de69c30c22bd9e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408151721169663-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d56200682e26e4c05e2567c1df48769fe0340a2328aafc81be21c58902f6ced9
MD5 73076a07ff7dca363b69a58f27a6a888
BLAKE2b-256 94966f6c5b10cfddda92da967d54ae737495388e8a025b8e734631cc6feae0fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408151721169663-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 17cf5325bb24de97191fb2f98e3ec2dca6b18c9748ddbf0c06fe8d40d90faa31
MD5 b4ff2e27fd7c89acfb5bf8bc2530a26d
BLAKE2b-256 f93ce0f122756701ab36351f27162d79715f68aed9b728b41221786a0f3cf196

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408151721169663-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3f732e2dacb6ab0d0a35c234fa66994efc9b09de1662e90fc9436c8907d5f324
MD5 f899867dc492f08a065e51b1fd8290e6
BLAKE2b-256 668a764a7f7ee9b466435b251f92b74aea63ff6f2fb1df3dab76d6a1fd491226

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408151721169663-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 ed4590b73692dd6fcf3498f64343264b295a77df7664ae0e630b49f402e9e60b
MD5 d4fd7cf5d370eb9fe78cd6fe8780fa12
BLAKE2b-256 2301f8170d92a6e9af092d7dd3b4b68b38406c1ac2d50e4c6efd3520a04f1e1e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408151721169663-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2cc92e98c9cda116a2d51ae499563c6ea12218455e34bd25d73acaa3865701e4
MD5 00be44aefe6be559e4b0991ba045f58a
BLAKE2b-256 703ac690e330c88166160f97c33c3368068033819cd7b9882e7e217ea5970551

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408151721169663-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 69d5ef0e18778f45b08ed74dd2fafb6575ce838a3aa5ea0681cc71df6eb68370
MD5 8c254fa6c1a61f117c0fd1a2e49c61ec
BLAKE2b-256 8b5d410f84078a2c4cc2a93c03d5a59f212259278da29c9210a2e64546145193

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408151721169663-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 76c7144855b0d1d2422588c3e6eea9fa3e41b78db433a90d28f4a014d51a66dd
MD5 f7769b9b020af363e611a1a97b08c3d5
BLAKE2b-256 b8217f7329186896d29c95e9670f11c467145ab15c1bfcbfde75ab94adcb8832

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408151721169663-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7397fd4c987ebf5e73a5f33fa12bef91bd59633c2d7abef381d0c00f5dc6c475
MD5 927dca162dbe18f379197681cbc6e8de
BLAKE2b-256 9de93f9786963b8956f74a2a2a4405152f7f2780b7ce73f21646da99999c1d75

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