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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.9Windows x86-64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409071723794729-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0c1814eae9d079e19bf2ea3965332dd75cabb1eced12dc53e7f08d05ae799acd
MD5 d6c0a07765c6fdd8805a8db33c661944
BLAKE2b-256 b5ea7f0cbaf8ec3c99d16df4e5cb945e7f38811b434bd3bf545bec54e1b63126

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409071723794729-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cd8fbddd87484c95c68bbcf6ea0d51da3e612e8196fb6e3add4fd59ba98d0d97
MD5 0bc1be30c740fc07f012b3fe6e771fec
BLAKE2b-256 cbe8b24cbca2c500a7d266c659622444ef7cee6eb6a41d5b38b4bbf2932c3848

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409071723794729-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c8cc74a70db243ba42af0aa9ccd0e479f7a519c41d7c3dca05f77ac7482fd318
MD5 70d590c27e3830d8c41d710b75e41924
BLAKE2b-256 ac1c5ae81e1d73ed31b31f5b1f219b35471f95d39608bd477515c8214efa3e0f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409071723794729-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d371deec37cba7d2c1808d968cdfb99539f7855b0635a963a309a819d5e96dbc
MD5 493757af8fdb22307403057b544b2c30
BLAKE2b-256 36914bd42d9b49a4d97af01f86fd7eac1addab5a107d00a5a4538250611b80ef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409071723794729-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 177db9274db1494f4bf35aa3d0510867acf218b5f1cd5c9088f1c9c4d8e9046a
MD5 ebd7403207fac930d288569434eff091
BLAKE2b-256 065b8568192494ef57a0432d4ef7c66e5e9ff18f35fa4252b7f713b01227aa0e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409071723794729-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 11a083bf8e2aa634a6f6147a256a7a6173b0a0e963cce6572db6d4b243345cc4
MD5 ce379fe7030ca9909d66d48d55804a13
BLAKE2b-256 3eeb29ac71522ff2a6e29b328ec4c41da2a8f6c58c358cda4647f8f9d86992a4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409071723794729-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d87271c090350dde6c4dc764a83615d55f8efce8b782e191ba6bff35d0ff3fca
MD5 1dc37ac96ac5d398a93a8578d99253c1
BLAKE2b-256 19782a2da920c0c5074013fee83b2036ea6a922302b87134aa2edcdbf5f04dbb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409071723794729-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c95f0e538b443ba62f1b578568adc7697f41eed3fb8ea1d0a14306f236d79e37
MD5 988ce8a9d7f427e817a418e6c3dd315c
BLAKE2b-256 5413325fc43f71cb6b375621939decbfee6bbfe73c33cc14f9d14c7af1714977

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409071723794729-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 aff60b7b08d6ea1e46d9dc02636e702b71f6b5ac096873cf9ace709e5f9a16e1
MD5 44e3c0d8276b4724f026b98eab866fbb
BLAKE2b-256 1051af6c1d80fef311dcf91f8944e99d826cc88a8cd58c69651678cf79fe546c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409071723794729-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 338ad62c01c2ca5bc7d1d191dbeaac39c8b3b00cff2f06370e073a074912ffdc
MD5 89a0c62ee856086af7b663f3225cc620
BLAKE2b-256 9d57dc663e68cc373f3eae57cc49f120695df3c4e292ec50412309424bf47dc2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409071723794729-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 2d3da3ef5ca90c348b42fb77c6cb993d33c198707fed84409895c3be466265df
MD5 e9c8cfdc9bbeea1562aa7b119885e0f5
BLAKE2b-256 4046cdbe1a508d2c2b5ea09c921c6a12e50223b6608afbe054070bf9e3323972

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409071723794729-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9b32358f77608b3e3ae05f17c74c4fe36a73a4ef3a9eba76cca240dc3470b81c
MD5 9f20dc03d6fa4293381c30ba7f165218
BLAKE2b-256 523c5f7fa088e5d29794ee33ef8d713e04a9dac2e71dce6e072e3abd206cf25b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409071723794729-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 aae29b1ccd4d1a0bb3272c7e590ba02edab75560ac4362ea9016bc6014819993
MD5 4e831a102f2816fcbebe86f69a3b8d10
BLAKE2b-256 2ccac107c2609983576ad716913f1c9013f48faa7cb18d6fb5992aed6b824d13

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409071723794729-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a95a62478f700cd001e44b15a28fb9fd3faad1f29daac1d9512ddbf8203ac0c8
MD5 1091b3b1d24f6971ed5ed760bb2a0e3e
BLAKE2b-256 09e26a0569753648a86914a52ccab6c187192895959661a17a259cda402f31f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409071723794729-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 df947370f0d42120161651f09d3bdc1e4502646b6ffc517b2bbd1a4404d520f2
MD5 5140e3c3a938f7daa297664d602d60bb
BLAKE2b-256 7ac6d33a961b86bd3cdeb2ac053f075b59a68b3852842d58c78c458e860e640d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409071723794729-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 61154311898290e26e024d00ee1c9713eb02fb3fcb271f72f7ccb85eab5aad67
MD5 3fa2e6fcfcd6e5dfd21734445297f218
BLAKE2b-256 2d47a5d3cffc1ed280695f50ed664c36fc92d10e21d3844e5bdcda67a0d7e2ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409071723794729-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8f3407afdc92606125dd5c305b777900874b7aa20431aec00035bb1db92ee4da
MD5 f61ce39d267ed8aba3486b2ae95ae2a1
BLAKE2b-256 1e38538c547d11e842604364784c553fc4ada9859b2225c24cb64ba11fa59504

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409071723794729-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2644bf741f1e210ce33f50210a8e74033aca47c39077c13b40035536accc360f
MD5 8e06eeab08a26217edcc171f4dbea944
BLAKE2b-256 7707fe9f55f1a0f44b733a898e97776297f4dd1c522989cf1aed443d4942d6b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409071723794729-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 099d7355d1ff5b6dda2a6500b008e5eb0b6dd6e57cd9997abcdf220a577272fb
MD5 95240e49f86fb0095cfda3f46304d7f0
BLAKE2b-256 55253c637e830a4860327c7fae10cb621fcfa9817f3b312b4a72bb44c25047fe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409071723794729-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a0aa4c7655f7b53f7c38f56dc573d673f54a6213d6f79cfa7276febcb359b4fc
MD5 37452518b58ded31e5ebf267a7820076
BLAKE2b-256 7bc16e1bff09b47f65f9509ec619383ebef19207ffc16749351fe050394a21d3

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