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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411221731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b678ac55da1f1dfb0d08e08e10fdc7b69fae0841cc78474ca542ffb2d5fcf4dd
MD5 5cf3e3d3b16c83018bf013653f70a585
BLAKE2b-256 df1d64c4e08e164f64b436e886d04d1fc93e418be095c65e4a50e772201b4fe9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411221731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 582f6c6659abb77d348bd48ec43701de3cf18d8e2e5d882c331e8493520de424
MD5 7901890e7fc1f0d295530ec567200436
BLAKE2b-256 768dd3ce43b55e7203aef8e7168cf81dd5eddb06d16817b886e97851fd95e78f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411221731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 cdc4413445239a2b6ef15554813d297d3781cb0a013ed921f7b031f4ad23be39
MD5 7f0f8e7800425afcd96df41792c00e04
BLAKE2b-256 f1cf4f771043b72b8848dc97a8220a89b5fc2d91938ffeecbcb7fc9fce443c8d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411221731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1e6ab8b5306823943bc3a8da65ef15f0f6de2840d895afa71060cb6c6e661e0e
MD5 23e41b76c441514e11d85fcacd781926
BLAKE2b-256 b744ed3c95d925440eeaf1367605dc2288aeaba779bf625a3d1aad8b1fa419ab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411221731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 97088aeac98201675b9b49d42196ba729e11391333391dc739f9211599a65c95
MD5 4fc8d78f63321e2355b3d1549111cede
BLAKE2b-256 10e95722bcd5ba57f157fb6ffd562bca2b10dbb252d53b1b86e3613da3801cc0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411221731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8d7e95cdfff150c4e858d2f1d25a860eb42fea40f40e9efcad8a3cf3c55b2033
MD5 7cf2f26e9a191d78c3a1c85b8c32bd3a
BLAKE2b-256 62b54d12b849f1e6b3914b53d2ee1c4d280f5269ceaefbfacf86010bd52ea3a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411221731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 635fd088a1d30af0e718c255fd583881c05352b84b40557ad05948ebab06ad7b
MD5 98971e4dcc198d0482382265ca760197
BLAKE2b-256 38eaae7f98da8be52c6244fe48b4f5d35dd41875d3fc4b7802d12574c3f706b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411221731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 088a718be38f043c84180010861528a7032584d77923be649033a91f9cc28f96
MD5 90f3b6b1d334e177a8aff5ac731daeff
BLAKE2b-256 a1cb318f89c692a1bd5f02cb0a0c01e37f2c2f575b62f71f4084da07f95f5000

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411221731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ed7a63f3fdcf67fed4a629069f321c8bba400b31fb4ac6d9d9aea57379078cee
MD5 050c88ecc301601b481911a7a41c744c
BLAKE2b-256 12532ac898433ab0e118a94853c89651a23e98b0f6541eebb893561316ca09c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411221731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 94dad7931cd61348ee0814181727958dbf2ac4060282230adbd5a5f56590f926
MD5 b8c6df853816092ea318c7be2ec3334c
BLAKE2b-256 70dbf1f250228582e0d27380979d460b4504160214de7706a91913ed4627236f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411221731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 0124c2e4bc04f8bcaf1f79d8be5784e2bbc15676cfc85774401fc9d8d9e130f0
MD5 50a691a63f1c4a059b6d890b1c04a5af
BLAKE2b-256 0bf5cf5d072f414370e581c126599a236420f557880fed567cc47a17220069ae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411221731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 55dc18b69e770a27a1e58f7e9831e3365189b300cb8cabda8a9e450f04e134f6
MD5 83324b8c0b3714ddc509da1d879cc516
BLAKE2b-256 df3ac30221160146e8912d07030993a1c14f6dfcf47748f2658d03112b16ca89

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411221731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d69563c04b0feb60b7cbfc3e54aaa87aea0a8845bc541a9301dc57ecd8fb61f2
MD5 a572bfa145bc00723b348e5e2474c520
BLAKE2b-256 865a6dc28c93d060128824463b41cefe3eaf658f4b179ae7ed8b3d1f3e2f56bf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411221731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 aff4cb79bc87fe673410d0e8c9138b562cd01b624a70244ae39093265b282a9f
MD5 9d94641c81ebe31fada3869c4565ef47
BLAKE2b-256 8fde605b5cb2ae0dcf954a330b342604e2805ad2d8f310440b91e5c2136838ff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411221731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 52f7315d931a262bdfcc49cb68c5b8bab469c59d20f89662ed091b645c5d4c38
MD5 13cfe0fcb6d377e34e53b803a20fafb0
BLAKE2b-256 346a4404b7913dbaf2c69d3ff476fd4a3be9c9022768718cfae8cf3e96e487c8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411221731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5f0a2c83b3fffe570ca918016aa99fe5d8f9ab6fd35fa83165e3174177b7fd2f
MD5 6353d06121307077e799e4ab9701dc43
BLAKE2b-256 1ab81b3eef0930fe831a64775071838936cdb6ad4da22640eb585992924b8cbc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411221731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 41d54c9b2c252261383bd6909db206840d9f887110fe37f499fe3db24083d036
MD5 8920224a881eeb3fef44b42de0583413
BLAKE2b-256 7654584a616926401a6cd9283a14a11509643f119427e1ec7cd3af414a8f0613

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411221731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7e67e710ed2739e26d7eb4a9feb892552708c03f770c1bacd67e6f204afb068a
MD5 2321c7b62e188d00a8dc142a5e40e478
BLAKE2b-256 f1f6b4865a10dd1eb61494078a744048b807acf092bb1541a71055364fcffad8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411221731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 39c0afcb07141bc94cb9b6937508c90df56745edbcc996feb9108a8719e05d1f
MD5 07afc75b24627efbcb30a3b00f7441c2
BLAKE2b-256 def8095f69c10feab3248e06ecbca32d5c777fc94257c2a0c568999aa7c46ccd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411221731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 647ec0aebb4e2d9facb253ddb6ae39172dc28f86c2cb893dfa4b95c61fbca67b
MD5 d9ffe7f59d82be078849b4f4ff4eff4f
BLAKE2b-256 25c7256b6474bffba6d17fa9a06f7ee8a75a938c23d35af8a67a46cb16468768

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