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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

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

Uploaded CPython 3.9macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409081723794729-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 77fd2a211c2f4baaeda4dd4dfe30bc4e92cc59c13350efa55323a9cdc0449fc6
MD5 51a8c29f5b48045e4e0f8c524558eda9
BLAKE2b-256 dfcd5a1cf28e508bb2b6ac55661452c370a9f75586d21f0410f9465d16fa8f3c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409081723794729-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 876da5bc9f511519876ae7c1418bf15939ebd9c78ba62e951a7aa5a6d55782c5
MD5 e7bd6b6ae222c1cbebf4fe8fbf46410b
BLAKE2b-256 92e5f43259d5de555ea1c1fa5af9d1c3f1892fdc8457d22a7008372a3c62ea05

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409081723794729-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7a3777599ce236d048f85723ae533f6ad4710fb1fc58c4e49676848dbe3d7a47
MD5 0aca95602766cd8f74ee607dbd08ebd7
BLAKE2b-256 b1aa2ee50d0240b032a6301a1e45acdd3bfea5e46f214dd66a9493a4218e42bf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409081723794729-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1cca6283aa15e287dd95cfab2f946753272f5d2bdbc6701dd856df2425261115
MD5 c0b8cdf7e3e3e86bf320c88da4f72145
BLAKE2b-256 117ba2093195d40cd921ca4cc2f3575573c6a1634ff8fce52d26f8636f852543

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409081723794729-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e9f28b2a107a9b17e7013e0e433666e2015420936e5a06b3521c05247f69e957
MD5 d07aebbf7fb3606a407d54ac71b30b78
BLAKE2b-256 30561f10b0c099d174b9965c72cd84b981e48de2e8ae82e83e1b8130a8177eef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409081723794729-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 657b691141df9375d70833afb24787bf8f8bb19077ed4ab34020f73f96048de8
MD5 34b8bdfda1d78008e45ce54566be639b
BLAKE2b-256 e8718ba4738817255ad26fba01f6b0bf5ecbbb5f87d79f19d721674b5787f55c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409081723794729-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1572d460c91452a32a7c5edd567862c69182565cb658a2dd530a95eb520b2550
MD5 0ec8da89630d1982e7bbf29d279e7c12
BLAKE2b-256 5456389ba670a44d6aec41308fb260a8d6aab75e1145ab0781669a0ca211298b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409081723794729-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 94923d74777c10e16a6ee04207de305279360f2492795874829e298cf9b4011c
MD5 1ac20a24a7638021d56785d9b2a2f5ed
BLAKE2b-256 f114361d9979039e0d0631c10497fae29810214a80de58abab79b7088d17917c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409081723794729-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 185573970fbf88bb7d06c074efb3394e6842e19ce85b7e678d4e998ffaeaca3a
MD5 3c1aad48ecc9b5217fa782168a1120e6
BLAKE2b-256 f21b24872d4aac74bec7f987f9ee4d6cafe964927fc9e5c9df306b7b7ee7a2e5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409081723794729-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 68cdb5f470b948fee10d7b295866e375c4b10052530f0f8b53e5586feaf2082f
MD5 939a366c52b922469db727ab5edf8907
BLAKE2b-256 538c6273fd1a3d89c35e047fb280d49e89e4c258d5d2d3ee62f625d1a20140e3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409081723794729-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 471ac1fddf0305384e23425da23cc9de362b4207d96b7df83ddcf7cc4386d7ba
MD5 06a59ff3bcb8c868cd6af402cd332b8e
BLAKE2b-256 a88f86bb457dedfd8a541a39f8025b746e696cef1f14afce8e5c923d5d4f619f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409081723794729-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d54c4779f889be7b45c3a3fb8ce84310cb98ec64853bcc8fe6a20e3a308d3008
MD5 3f1f77ee321540b085165c9df7aca291
BLAKE2b-256 7dd709d31577255681c0de841cdd6e01ea686ce531f961a4327df86fedb846b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409081723794729-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1ad567ad403eeb9e06061f83520df1baadf12d5e4a0340e7c7c785f86e84fb4a
MD5 105b83f63022fa26f600268c64a570e4
BLAKE2b-256 eace99392faffe2b3c567d5d048d545871070b797477a0ca2c7e313e3c3e36d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409081723794729-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c19b4e4bee7abb24003f05f03a46cdc7a6cd2f9b346c7203df5b88d531949172
MD5 9ab596a8ce979a996fffda87bb4c6ab8
BLAKE2b-256 e0dedc0c25910ed17ae177cc4c295d2d0ba50a3a37b7f218dfde71d7a0200cc0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409081723794729-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 82ac5caa86879e7fabefb7f2791a1347762d4254b9654a9941d44a7346d8745a
MD5 179913618aaf9eddeca397fb38705fbd
BLAKE2b-256 d698e69d1135aca02ff03140b9a167ca1a617381012dc3abe73fe35fc8e553bc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409081723794729-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 4bbe6d4f959e4dd679959e57168cfd105e3a5400faaad6c8c4f69c4012e37892
MD5 6a67725d1f2bbb683354ee160c81bfdc
BLAKE2b-256 c9dd6678cc4a631965b2a3a23deff4cbf46d81d97aed5af09d185093a2a8b9fe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409081723794729-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9834a30f6cd692acb62a52b76f53ed540f8488da7037c667a6d3e30068a20f34
MD5 3c4653ef2fb1e2d1f38b2f39e0a4750f
BLAKE2b-256 0e43915c59d6a3b1ae64e42fe09fd9d5ae73b91ad742ba2ecca9ef03e6693b71

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409081723794729-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f94eb21820d59d090de0cd767a7e57cbcd3c0508bbba9018446d5b6862595a23
MD5 f516d00750d680a7c58e1c59d57ed64c
BLAKE2b-256 4097026f2fd6b1b446e9a5fb3ae60caa24a2c8b7f11041febde1b89c6903fa2b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409081723794729-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2b233e57fecf72a9ed67804e1e4db71b314727db0052e5f3e94fa0352b7e1c24
MD5 40c85ce9893fb337ed502851b4a3ecdf
BLAKE2b-256 7bddf2cca0af26f99854159c848a052e792790946afc926f7447ef092632ed8c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409081723794729-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 42132af75c89e2573495516251737e50077f0c811e596c2fabb5e379468da3dc
MD5 0e909f2b654835f391b9877381f9be83
BLAKE2b-256 42f839fffc0c36844fc3ca330c41de7af4f23a8e58598d64ed420e147e16a15e

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