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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202411291731932516-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.dev202411291731932516-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202411291731932516-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.dev202411291731932516-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202411291731932516-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.dev202411291731932516-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202411291731932516-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.dev202411291731932516-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411291731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 dad8e78db0cf3e872dbf244d0c3bfcbecf86fb01abc6a84509cb62399b240255
MD5 f5398dca213b227315e83f7836beb6d0
BLAKE2b-256 d295e22e0685b9ccf452dd8bd6c827fe6c4667f6fca8581b27f4bad67a034f9c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411291731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9466d119bda226c5ca4e59ab877e7fc9a41ae429dab9b41cd151998d7843b99b
MD5 299ea78b1ee058d1dc7f1c368c2bffcf
BLAKE2b-256 88dc4dd1cbae104a6c9c644a39df012afabd33668521f136912831dfa266df91

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411291731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 88e8c312dbafb7d0f837facce67329c0ba0e9eac0a4f83dcea1d825936724aae
MD5 1016eed5d893eb57dc5583f2e6c0cadf
BLAKE2b-256 48279ae4586769b1ea0ee9c6033459001f5eb622049cece4e2ac5b61c723d77c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411291731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b9f19e9ca5be15b526f5e9ea056bcad98cfc18e520121205019353e3493431d4
MD5 434c02ffe3d84b8843ba239799c3484b
BLAKE2b-256 9e534fb105bd0d5dea148d4517dd5867a94704d9091e71eabcd3a006cdde24a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411291731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 f843f8b81c675f2e9f72df7f1d80cd44ec05096384a2b4563961d5afb0d80399
MD5 523cacb4f7cf7f8f35a6e6642b8aa043
BLAKE2b-256 c8b3b8d1426da9facef068321394e644168fb9945624889891fecd75368300be

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411291731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 c2d3e2775d08e8aac45ac539fef58ab1134aaaf6c9924519727d621bc66805e4
MD5 d4a01452d3d50587a0c59a951528d2d5
BLAKE2b-256 153d7b6e32fa2a188a74776c95888aeaaf75c4ba7265d2a2dd9fb9eccd9b2733

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411291731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9dcee2416c8b7335e63fbd7a23996d3f0bb8431700eb6bab995cc08331c2dbb2
MD5 5af9a55f322b021e8408521126cbbe5a
BLAKE2b-256 402b3a12f9ce032dbdd86ef88708c9ced074f2d085baf47735177c5ea83c6062

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411291731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a2a970ae06158637c639b093da09298eab284dc2422be0f6646f0e83f854c680
MD5 63fd7bdb6a7bdc28e63086ff1a6a5b45
BLAKE2b-256 54fdbe0b6d0e70b3d9b0693dea4649621cd6a46ee0a34fcff2e8302e3f7fa5b8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411291731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3affcb17410c80dd4c8040efc21b5d4a5a916b3cfcfcf9575671fc1d876e9fe8
MD5 049ec7e3adbd7a773a0d8f75ff0282d1
BLAKE2b-256 4d57f670b4e677c0ccea1a95cdd122d3adfba661462f013cdc06726980333059

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411291731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 931d9d39e37b789889c51b354f7602777ad53731b435cc1f979b786cf3006a6c
MD5 aa843a363c10a55c4356a5f51e0ead99
BLAKE2b-256 3dfa605e477649e5cbe255024664a41e10ef1cb7de1ba9fe53419cbb567e976d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411291731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f4897fe4078c4fb50bc6ea7d1e986a81c3c0f66a03624dda286fa8d7065ae938
MD5 51894884991c1b8a6a0135265066020a
BLAKE2b-256 1373f51a3506010e5a6afda77184925c49ba575cff5d3c7cd69917609fea39fe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411291731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0e93880f4424b48e82d013c5a4146e868959706cbf088977a65bfd3fc20e49ca
MD5 a01151414697ce2768d95ef13a31b544
BLAKE2b-256 d8be31887d8ee2997473df08447d9bd557d84e10a9a4a2c2caab6b17b5b2f37f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411291731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5fc1f0a9f05d67bdcfafc4301aa0970af6733907d7d56578e71a97d45330fbf4
MD5 46698699a05cf808aee8073937678f69
BLAKE2b-256 37a257c5daa603b0d73a1a97a26f4c168df86cb45cc78edb5d4226f976c1ac44

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411291731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cfffee87cfa36f537aff9db0328637310e84cd08864ed817aa9c7bc8245fe9e3
MD5 28b88e33f2e42df0374280a3a14039fa
BLAKE2b-256 e3f8c15373645b0cf80755f19bd4a9eea4ee3a42504b7cd2aa34392112be4cd9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411291731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 21da86cdb63b376faece984e113afb8987639fae0b49b9760d48df7ba0e1b6f8
MD5 836b6bce0fd6eee7b7ebcfa055d174e4
BLAKE2b-256 cffb58c89d96eae6964eca15530142815078c49067f6d1ab60d2ae8526da0b22

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411291731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 570515ca9eacd62eefee293f64d4f606e6fc6a148ab8225c83b7c343faa4779e
MD5 a45bda95c979d8d9fad7bc8d7ef5d4a0
BLAKE2b-256 0c86388c86b62d0756f641547a898ec9a1b2e5c09744c49e5134b678e9ee89ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411291731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2696e148c657ea7191c832fd0289639ad460e298c27e319814210a41733bcc55
MD5 ee17668838819f97f8cf16ba1100603c
BLAKE2b-256 edcb96d88a4eb9b842d11270482031c8ef61d4d9bfa3e65ea869c9803225438a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411291731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6d3651987bcbc1e6a22c3dcf864d8aadd7dd11aaf336e5d2919c25965bb7efae
MD5 be34ebbe88095bcc2f4d1ab1df54796f
BLAKE2b-256 f0a0a39ef3c7281b85f44ccd23c6f9e2f3bf96e04b61c65b25d4c928588784dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411291731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 41f0dd8baddbb4244ce640aaeb6a2fa4766fe1004d28d5acdec4dccf49e914a8
MD5 3ada0c9c3e50affa62204c8cd66cae16
BLAKE2b-256 806b4fc86e0d9af3982216f0eaf2b6bb5cd49498dccb579857ebcf066a7703f7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411291731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1326c38724de28bdbab4feee99789594cfe5092aa0291eba28ba84668aad9960
MD5 070d1be99bbdd737f05fa08d2aa7ef2c
BLAKE2b-256 b5865014b29d6aafc872e4dd0058c77ce9f78aade47a25a58ebe7c01369905de

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