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.17.2.dev202411241731932516-cp313-cp313-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.2.dev202411241731932516-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202411241731932516-cp313-cp313-macosx_10_13_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pyAgrum_nightly-1.17.2.dev202411241731932516-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.2.dev202411241731932516-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202411241731932516-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.dev202411241731932516-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.2.dev202411241731932516-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202411241731932516-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.dev202411241731932516-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.dev202411241731932516-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202411241731932516-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411241731932516-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411241731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 28f5a67942adfd26a6276759e36a81ad4cecd20211cee4f53dd14149dac22ebb
MD5 2ae416582c11c602c1b7a74586e06331
BLAKE2b-256 b30ac4d3474788927cc7436dbd230321195e0f615165bed741eeade77c5e8d9a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411241731932516-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411241731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 745057fe0346992b65fc88f334c5ea5c4abd5d52d9005526c8322ad82074e4d0
MD5 79b27f14bf96e5f707142f8daea1a666
BLAKE2b-256 a950f1e46110b0e5d766c34abf3de949033655c2e0c771baebd923235ee347ff

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411241731932516-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411241731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fde7cdc2b2c296951ccd7caec7a7cd369aa55944acdf37d41d9a7b741dccedf1
MD5 6be5fcf5194dc3c655505ac7b8c46b5b
BLAKE2b-256 6481b6eaa4ad97fd3dca42d88ad4716f130ccab3e2247bec508101bad4f04147

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411241731932516-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411241731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ae6ad01305f85547bb01cd69f8be5805bf2922fb0cae315cc835073fe4eecc70
MD5 a66a5a1cc61bfca5ea2301b513d241e8
BLAKE2b-256 47794e5cdd8c314799abae41c24c4335e6265c57d86e1352714d539a115196a7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411241731932516-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411241731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 47517158f4dd72adcf5a0891a83c882b51c70ed158f78a2282da8d899b734c4d
MD5 48b82e2bdc3b358d394bba58d4d1b699
BLAKE2b-256 86d500c742edb10d275ec935b9bae313916427d8341c1fdafe2be529eaa9353e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411241731932516-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411241731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 eb24934b16e9dbefcf0098ff4e4db26104f8cc8be31e32ac991512a2891a01e0
MD5 ff8bd9239a7dc7b71132b9049da55378
BLAKE2b-256 90dbdd8cc9318f694d1652c0ea6f13719be0bf6d30a30bf3ee3104cfd8fb8733

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411241731932516-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411241731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 66c9c25fbf7d3f6e93938db4e57d309386d953fb7056db6be4bdccb648a23357
MD5 bd7eef8c051f83448d013bf82d4d63b7
BLAKE2b-256 0faf79f7754afc23ea3091251bae04dcd51c651825f26abbf6a6495bc63734b8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411241731932516-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411241731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 32ef9101a119da2b2664518ac0dc90b445c6b7e222933db0b54dada2eaee0dbd
MD5 6b063c754e862f982d329ee45c468a88
BLAKE2b-256 677cd533e309ac007e1bca2025aeae04cd4bed17bb31d47b0f1b860f8de74cd0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411241731932516-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411241731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7af4c62173660d40a2da306d019c4e414cb4b027ca6e5fe127b414e80389fdd3
MD5 7735ea31edae2492a2f3e57ddf3832d9
BLAKE2b-256 d5202334e9f745a09327847014b8c475ace058bc0163a86076ab5febd2257f3e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411241731932516-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411241731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 04a8bf4f5f6bdde626f76ab19696e237fcc32f8f6dca217bcf37b2532063a2ae
MD5 6dfb13f0afdd414e784ec1ecdb5d240f
BLAKE2b-256 b61e826a8f3fc966dfeb226251ae1abccd5ff1f03bf52b4e0b49742d52016033

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411241731932516-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411241731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 1df2c0821e36d66a1a95453d8e3731b613b5dfc6402eb090950be2ddb6594d0c
MD5 e624dc3b0dc160c0f915cf3aabae3416
BLAKE2b-256 1057b0f3f1f48534f7b92939836d0f270b3f76d59a8eef926406f84cc1274a2e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411241731932516-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411241731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 db491d4e298a508ce9756acc01bd5efffa3466b7f849dcbab13a21a9abf137de
MD5 a76713096c0195eb5f8d792064bc9c42
BLAKE2b-256 a1ac84c6c73ffb57080eb77897d181d12e6a7ff77c011bf1c97a73c21727f45b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411241731932516-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411241731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5207a0792e62b3d935283208b7a18537b28a2ea5651bd829e5c630a4ffb076f9
MD5 68b828735a9d9f652d07a1f58e01bbe9
BLAKE2b-256 e6f805ea3167a9749c190bde684716c2a184e58d3b2af4cc318217c35d79b42c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411241731932516-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411241731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c7ac4e44c64f82ba8f915f8f7a5150d3a01337e9a885091b5b7cc55f8ecf713b
MD5 08f1c585e907f7d3a869eede8b9493ed
BLAKE2b-256 1c74b32569dc699e8ea085843da57f10f521645567d9e5be299a185ae4ddc479

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411241731932516-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411241731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bbcae5adfe569281bb428bd50c954b9f79626f3be4d024d742e2e225bcc05e01
MD5 9b28a3d4f0de81cec8184e5dc0446a10
BLAKE2b-256 b2ad086b9fba6617f58ebcc08e78a684a3a8c8c4a6e40b22224814aefdae23ce

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411241731932516-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411241731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 08660ec65041366297610da635ab24c63fe5bacb3a96a51997d4f933ec4bdb31
MD5 122f15a1217571f00b3dc49ecf9775b6
BLAKE2b-256 0911add5c11fb93a9d46356e8cb5ab8046647a70b1dfa7d3a24eae6b2aa4d159

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411241731932516-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411241731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3b0efa0537bdd90dae0b9352fe7abd1f3ccb67a2d629b159f0107c666106c9e5
MD5 39d2ef1fb623abeaa3ec68c0615bcbaf
BLAKE2b-256 ad43ab0fa01704f534729f0c766cee75f205128ea997e5ca64b5194a10f24043

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411241731932516-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411241731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 427dd5400a891b13634a6c4650101ca4a123af64cfdd889acd712861047a2a68
MD5 4f64b0a9abf7e31ce2067c93166103e2
BLAKE2b-256 1c40aa941fa153f2d7ba04da233d227a58e301b6420d0f5c51feef8e97279b7a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411241731932516-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411241731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8679dee70f66b8e4453ce68ec72d0e719558cbd3e0fbf5b4e8570f39da5da212
MD5 d73e6a5ca6dda1f9a38d95f9dcc2ae42
BLAKE2b-256 8b72c1e68da3a54da926d8598330ea91040adb19b3cfc25b7b1f232cd7380c56

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411241731932516-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411241731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5685d38f56dc599652445b791603a4e3689cd36db29ce0af77dd4301c6918c6a
MD5 95452fa80069be8854f2306e187faec2
BLAKE2b-256 5994be4f33b4b23fca78e660387f2453126516710086593063b2ba7b6531ea9c

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