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

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409061723794729-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409061723794729-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409061723794729-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409061723794729-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e87f73abc6e3dffee9f0add258f2f8ced207895f890a8e11a7bac0a17338b557
MD5 29544e55a31ac4c122e544a910057656
BLAKE2b-256 bd1d4928e2504378f75f8524d9dd7447da65d5835e6bc40e1094ebe257a30e59

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409061723794729-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 baac155e709d76e40630caf5112929b010db31e89d6d19eb7265fc83b06abb87
MD5 00d6e2b3146144bcf921a9fa2a9a18d6
BLAKE2b-256 2309a585188714ad0b062986421ce03c50fddc6fb8bf4f78c41723a6937727b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409061723794729-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8601c1829bf7643d440e866b645f7873cbc97063189b024ab15862aaff4ebf57
MD5 ded2356a09433dfc37e9a285616fdb12
BLAKE2b-256 aeecc572e8a658fd4fc1f7c8fb32473461f17fe50d241599b75ccdec477bef40

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409061723794729-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 62238ddf6b2219ada930f3f2face6e5e57c0d1a69f85d68052262b1e88c16e54
MD5 c2f311ed3db25715e0e118192c6f05da
BLAKE2b-256 d6469f3600c533d0f3acee34066e42a5bffc10cbbdc90743449d23f37ab17ebf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409061723794729-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e0b847c86940017e8d974fb1efa1ddc82b2129c7ead1345e5addb156720d5041
MD5 9214a1fdb43cd57733b743a28a9bc027
BLAKE2b-256 7126ea9747ee3624f1a713e0ba32b54514bfa5798a1948e953f3307eab479332

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409061723794729-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 41b3b5232319bb8fd2a167ad31a020b4937d343b2fdc05881c9eb40d23ae6351
MD5 629a2609cec9a8633b02c5c5b5bebe21
BLAKE2b-256 02449836cb44786c8820bc28ebd8881b2509962071d4b6e75b7a101ccc6c7ac3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409061723794729-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 167258b28092ec53ce4b62dfaaeec1e1c80a533e1eefb0e92a828331a4d60b1d
MD5 adc472f0ff730ce7a3d634d4cab0e02e
BLAKE2b-256 5b243d0ef7c19bf36c869436108e8790b5fb9ede6157ecd06928c50ad573dbcb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409061723794729-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e1d1c8a4fa50b4be8bb77e09ced9ad35acec4786dc62ff451b4b236b0204b2b2
MD5 9f21d0ff6a63132c0d1a655fc840c4c2
BLAKE2b-256 bd4555a231c51976fe3ad588e002f587ed8bc221a429b948ecb95cdda99ccf65

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409061723794729-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 60939cd02bd1667c7bb6ab88566023eaaa82847f130501be03dd9cdf72771b7b
MD5 c392bb0753bc34ab3cad755ef03a52a5
BLAKE2b-256 69674efc21d36202933b07a19856efd0be067f997bab5ab647c7e6eb7744bf10

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409061723794729-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8f5b3c613417781cb74f5f0a694871d7e6ef5d36200b08a0b36c3eb80359d1de
MD5 fc119562936217e35ed72fc2b9bb7a7f
BLAKE2b-256 a20efc4a62e1c46134c843fb36e5dc5a2064f91dc06242c8d8ce4bb219beeefd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409061723794729-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 407575c43c6f662cdf120884f0ad6d99f534aa015aa2a54adac7bc1622ecc138
MD5 54c7f4892953741c02dbf1b6d86a4e6e
BLAKE2b-256 13ababd28ca2cce5fb17384396c866e4164762d17c963c784d4e8cd3f0ed12ff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409061723794729-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 be763106c291b14e5ed160a84a26362c387b69dc10e28bc82a556eddae6af618
MD5 2684d24d8ef9b8ec4f6743797ad9a31a
BLAKE2b-256 2fd0aa5782f103058d6f5594afe9e8189187746050c9e21d4eb1c69c9c406a7c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409061723794729-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7105f9e733035dac1e5f1a2e26a55f9001bfcaf28fa5d51197faa334b52f17e2
MD5 f515e4eca6b0ca72d19035b08bf8f14b
BLAKE2b-256 22b51378a67c0596ff9c9c3f832382571fb723884219e1ffc665cfe960b089ef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409061723794729-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b0902eb8afd6f3c2309d815675885e3c3ae117a3d4a5943d85c67aad30556d8f
MD5 2d8c92a337c7748f7c050d9c837088b8
BLAKE2b-256 052e53054ae3b00aea535e15ea33cbe1e1c2c93559aedefa7b50d528830a2551

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409061723794729-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6e88862ab3698a480f0435992238d535470cbeb2edeebe5b53f8974f8aa07d33
MD5 0f5cd5c4e91e375f058706db59747fad
BLAKE2b-256 4265f979081ef9dce1da5df1917efdbef2f91a3e271ec700d48bedfc7ddcb501

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409061723794729-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 d499c857f01af9247225a0369e30d15024b46daedfc3e4cece1280d4f121791f
MD5 da34a37f54a82d7ea6da2c4329489b7b
BLAKE2b-256 5a4375ce1c511322043ff2c41aeddfd9f5bc8d3ad2f44b4e0ec12126b3cb4b8b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409061723794729-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c091504562c5219071c99ca97fa5cea4aaeae5440cfd02b7968c5bf8a1519778
MD5 e29c96bc3a503268ce5228a650ab6d57
BLAKE2b-256 7bea70ed636eb474709308ffb408b613ecba092360d023673c478b4f208ecb9d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409061723794729-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2830144f6013d6d4b8efa7d2574b24ceb828a5eaf6d1abca964adcedf46c9aae
MD5 6b031c9df63068ed8669048584a3b9b9
BLAKE2b-256 b94c4264e5dd3a149a2b74453d7eb332a6f51fed47a62ff89457b252badde4b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409061723794729-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 96f84c1da929600211b1877eb8e459f01f7fd876706941799a585098a02b0049
MD5 02b7e603796c986d325262d7863f1d11
BLAKE2b-256 d446b04f0d4cf09798c55d720c96714e660fadf5d62ce733fd6f66e167d5b14c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409061723794729-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d33b2aefdfec1074ff1218ca9da6d388303a187282c74330e5b8dcb1d5f0e7c7
MD5 800bda6c71ae4c3d304df19eda88b886
BLAKE2b-256 ecae8e8d3e286c16c597e1c4d667e9fc22bc27917b4dd83b083ba1a1a89b246b

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