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

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409151723794729-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.1.9.dev202409151723794729-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409151723794729-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.1.9.dev202409151723794729-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409151723794729-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.1.9.dev202409151723794729-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp39-cp39-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409151723794729-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.1.9.dev202409151723794729-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8a761b78b3b3dbeaaf17c045c2d0b5e9b1896de90bd199f73615dea71e82942a
MD5 ddf2c3465c02b1517801d405d1beade7
BLAKE2b-256 c8f61168afb5a10fea9bb621a38e73b9a8294e6163dfdb10613784a59be60117

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b07ee9319909a45020bb53999e0e3dfc54531fb0966e9f84f3d6b916ce6da1ca
MD5 fdbfa1962b3ac7ff96da6b5e9ab9697b
BLAKE2b-256 c1dee2326270367a20341a1b860bd5e88597d20b0c15a0fd1f48623af66cc1c9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b8e207d06a2cb1d9fcc9270d4d0c109fca43e6f071990722a4ea2a563a502e21
MD5 3b27cf8a61400787fe62a9d04dcfe591
BLAKE2b-256 a54a840f8aa26375e4a2653c8e52e45c92070aba4e9bcfe262ecbeb1aa57dc34

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e2b1d284dd0752b40ee42d2546b97e66a6e31f5c4d1583dd790293bd53d03bbd
MD5 1a5ef9228c521e3a5150599bf0a7a6c8
BLAKE2b-256 d1e186aed5a9df881a49641b9c52d72e4aff081ed0c849f8a78de7b34ea04822

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 62b1d9a63e1d6fb1fdb2fe27f8d131fb8e95e584370929617b55c2406838196d
MD5 ccbc15faa94f62890c33d2aeb4d80308
BLAKE2b-256 3da74b7bd558be817f4d2388aa450593cea37a90278223ca3d5b446728c8253b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 17a6b4585e6157211ee933823e60d4c77052bc70e6ad6348bda97aff4f35e59b
MD5 7f87cd131b20d7a08c5b00b1740bc799
BLAKE2b-256 969bafcad67a13fff886a7a88750ffe535d7dc0f8d57e2cfec6750d3c987582d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d44a8724bb3533b46a84b4eaaf47cbfd83ae0fc9b0647032769179d0aaecbe56
MD5 015c2eb467e61fb2d676b85c5016e3da
BLAKE2b-256 66c8d85276b8b6a69a909e77c5626c9e6f36892a56144fcff4b397f61a45b8f2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bbe7bc5c7200c5e3c27256d4b36b7bc347ed20786c59f771340807f330ea20e1
MD5 80510d5dc42417f13ec72e4e6dd9e308
BLAKE2b-256 77a1c59422b09258fc1f8bf9be5d6dddac73b531af2b9b1cd4bb8d8de4e50a43

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 510fe6c93f7703bc049f7fe635286829335a81f1e68c946fb7815bd680cca38c
MD5 dc2f9a2950cc43ca1fbe760d4692c2c2
BLAKE2b-256 0729d1c0775efb5afae76b25421314e79b2c56ed76c8d0c461b4a3369a775c00

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4b6e3081864442f4c4274f24b3bc00f5d0d7f58f67bac9dd7adb6d30fa729b59
MD5 4a8aff1aeb58ce80bd256ea92aac95d9
BLAKE2b-256 d22161a3586c35e29a36e479a7b83914abd154a0d49a5523fdb881e23f70e4c1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 9612043d2543ed48b045598806f0491dc633d81b3175e520a9b96cea09ec2739
MD5 f0de43294bb64a50e3766cb11d7d4d2a
BLAKE2b-256 0e390388a9f7192ab236ca161c22ec894c5bb68f920e67a425287572e8791ce6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d0f169c03df2328b0f007674ece88d7cdc38acf301c552f59d6e237acb272c51
MD5 933a0ded84ce98b1b502e3457c489ffa
BLAKE2b-256 23abe90882f8be867d6e6fb8b8759ca8e9f8a818f7e732b1521e2eaa7367400a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a0239dac8e873d2c166a3cefd2d097a8173677d663ade02f2945854f2d5422f1
MD5 9e6792d9662e4ebf5815c1b8c1bb0c6a
BLAKE2b-256 32a7dfd40f09e308ad47b9100bab72e39cd9aa47118388c09230ce65fa49fa0b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b3b62433e8922a5d91551c1d1b7885bf8831f7a4e90e3321cb1abfbe0234f3de
MD5 c52946ad63c29c598fc0929af019e48f
BLAKE2b-256 4b2b829a2c289cfa2daf73611453f3aae7f1a91ccfd48af1e2eb7510fc149c7b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1081b22ce0403936c947b26553bba118ba43ca31a7db7795a8d4427753b96c2c
MD5 5f0578cc482524a51820d5162e0deb01
BLAKE2b-256 748732fea0a0fca667ca69063f72de8901853c5b007f5d19c007e2db76e1f9cb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 538d921a8df47182d3e9bdebfed6910e972107b4d31ca71cf411b5460acd9f69
MD5 2cfb3bd61c147ffe1277a41d408c889b
BLAKE2b-256 d05b2241fd5757034a3f6b88bf8974df34a4940c259ec4c473c0428b848c2fad

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1123137434b627c6de4f404ffda536747bc89cbeaae3c23330d1b0caf128dbc8
MD5 8f5d663ddc61c7674855994cade7277e
BLAKE2b-256 d721bfca2f59f5e8ce39ebf459704189d5a61f6532cee479df8753de13f5d01d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6ec0c563fa642926a93bf6b12ab186c091bc7c8256d06e5277647ca684154d03
MD5 b1e166c3c253f870574a91131a066447
BLAKE2b-256 604d36fc3eae5d3d12d75fc1ca731e39c147d0688322ed1b28e70138b8e77210

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6637435ed15dc34362b77c3d8647f65c6912691ff34f46ec05fba9a8c23dc194
MD5 990515d8b0dc4e422bd7b170c8fe1a48
BLAKE2b-256 28f9658120d2fe66e453eda1bbea71dcd711252a5f3a568dec98335db26ba6b9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409151723794729-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b9a0ae988e3ee4e27118aab6bc7e781c2ce7c07aa9b534213bad7ae33ac9629b
MD5 3c59f92a228a29e8001a501bf6777589
BLAKE2b-256 a58e6399144a0e9f011b07ecaa37940fbf30050dcd772a54665cb3e7221f311c

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