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,2023 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.12.1.9.dev202403251711221216-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp312-cp312-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp311-cp311-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp310-cp310-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp39-cp39-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp38-cp38-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp38-cp38-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp38-cp38-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d0d50cc877c62cd5148a3afd46939c06f8e22488aab2eab94ba01f55cdf7e9be
MD5 0d08b4e36e4cae30ce05c33ee81516df
BLAKE2b-256 196a6c488d8ad07b0e8fea302762403975641b5a0b9992fa3236df21674fa99c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f8ec7c88b842de65aa802fa7b635ad1dac20bbb4e77493c1ca581c3070b454b9
MD5 0867ef234bdf0dcc0cab7e48ddac993c
BLAKE2b-256 a7819650fc1e12686fd0deb6e19f6571a1b4d5342115ff81280510bdac538059

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b0c59c5a716402f6ffbe6abf080d94e609a726c32ed759f793f06c40f23645ec
MD5 ccd6457d242b1f18d98ab8bbf965ff1b
BLAKE2b-256 280347e08e85723f6aeb5c20d18f40e3e44dbfe5da043acb786f9e8ca4bda378

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9f5135837b2b8e1ca27bdc85138086c9d2a9aece4cdd75944145b5d0322217e6
MD5 b0be9d78c089e8ef734519c6c366ed37
BLAKE2b-256 24c38123d0bd97f25d7ff8fdb4e71b02a54bd3d3ae4dc8a443aad06aa33fca6a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5fefa3cbe25bf5120567f37e9b06edda5cb68544e04e5e0b9c3c5b26fa52c6f8
MD5 29165d5f1ef56377e6c5a2eb3adc7a43
BLAKE2b-256 d35d7ae9b6056403fd9137f328074ab5028a7fd092764dfc355e9be16a9d8325

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 9b5c8924162cf5270410301eff85ced8dbcda376c4eb4a1a6f9bb159413436ee
MD5 e687f046cceb6c13070e885ad3fae4f6
BLAKE2b-256 a820087bccf6418b8a3268817ddbe26da2d1739db05f37e9303fba3265a86e73

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4b834cf321817744fdfe07e6584c2f966db2e5b33c6d6629ee180b0dae0c48ab
MD5 3811fc23f32b3e1dbd571a3ec4abca52
BLAKE2b-256 7165bb4bbd47fa39c25d05b2311722c1548ecdad533a6a2fc4b089a227e8e080

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ce9d1300f476c38555a80872cbfbb93f0eb5465ee99c8d35aa87c612b66ac306
MD5 09544b606e3f3db3b7bafae9d503de35
BLAKE2b-256 ffd7c4456439ae1aebe6128d239535d5e50d18ed0b902999868b6187a3aa6e55

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f1309aa82a64702c85624284d4bfc665244d2c060d3cc652dcebcbca99cc35ae
MD5 6bd72fea00d3c804380b3e604d8eb2df
BLAKE2b-256 8dad75282527d400e6b14174af7f3e07be15348dcd4bf532a83e1aa920dcbd9a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c390e78f3b9a227c361dbe9229ed3c1d41bc41cd4ba9408067c7b3f7b1b08c87
MD5 aa0b44acb16e173ad75654851e9ad681
BLAKE2b-256 aa057614c036c4e6af2091e8a2e5f738d7e0fefbd57536071bd3ce8b529ce38d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4b9125c77901659397f2d98131e257aa41c97605e14e91fc6ea9a05b54181c4a
MD5 f734cae33d8490b3d14e55a5ccbcf1df
BLAKE2b-256 26c9b39fd6d41e54818bf5abb07ebdde87cc4611f7c9308ecf2a784addfc94b3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5c8a54d95b80ea778a9d78f65bdcece9f8b3d16df20f85cdfa6c0559a493b58c
MD5 6e70e59afd1777c8b6a7ff2f87ff35b2
BLAKE2b-256 7f78a6cb005c136b7f85617d89cef04fba9754db529f84ec19ef4f757c7c2d94

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 764d7c638ba6d758674a8c55f56bf465218ab0b5386f6011b79b4e1e4b0a8d1d
MD5 88240af0156f3a83238f1136f8af900c
BLAKE2b-256 6bfaff38503091bfd8730a569c080d2373031144a47d36cf846b6a0a6454d5da

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dfb6e18ca52ffa77573387cb3822eaf96709b3a757a44908f06e818ded28d93e
MD5 050155ed1aa5c92ec15ed9954dd48294
BLAKE2b-256 95f0fc951eab97b8533ecf1d79eef6196b7415a62f572d0fc0f1831372b5c12f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ae0523aaf84313a383149c0f2cd66ee199634c10bbbfbdacf1e68061beb94f06
MD5 68cbe0ccfed7e7f52dd613015786c912
BLAKE2b-256 c497898c3a462f3182173258d6a507af3baa09ef6996364984d104cff9200ae2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 ebc1576b760a48590bfbe7b489ff6ecbbd9d88eaa905b33d7ea8b0c0182a1ebe
MD5 01ea9f7c252f5a323cd842889b1b7b5f
BLAKE2b-256 286075f397530896e1f5beaf913baacb9756af6785f82b22936ea4b91dc6f7e7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 eb879c6db1c226ccd120e9f0f82779617a66a232fdc040cf99c76a6234c0443f
MD5 f280486dc5688b5141d6dcd30960509a
BLAKE2b-256 0da51ee58a5953f4443553b45bc0438ca0c1ee665014a5591af2c0343c0421e6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 eeb314e5c1aa2b36ed7bfeca493b627404a60f50099c2d3d739ebabd7aa62b2a
MD5 7f4500eaa651d643d4a8fdd42a7b203e
BLAKE2b-256 0e8c68e6c40e9794ba3760055022df8132d817490ea76e159acfa730a9205d21

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 27b64dc2aa8f3c341158a8928967a9ab49fca2fe845d7f7c5e8ba02093e4cc21
MD5 eb1c19f31ebd55434bcd86bae7cac39d
BLAKE2b-256 3c137b1b1ccef3a364a6b5a8ac4c2a797766473078288b93bcd72729bd6b8ed6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4404f9f50e34b1f700f746699d17a6180922940ac44135608b681ab3288b0a41
MD5 8cd8f045284cb5b50e3021b6d2d0bcd7
BLAKE2b-256 15d7f71a60b58bde1fc32a87184561677154088e8946fd5f4b8b258a4115a748

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 239cc1d71a1bb629e634903f681bd382dd72bdfc76fdab2ddef84b200c81b241
MD5 0433b3828e8316361afbc733e75aa940
BLAKE2b-256 40f5db9511e95a327850765ad81e89724238872bcfc55217c177d5e896e9d8cc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ea423a4fcd9460b38bcd09ab94c78e18efe0419a5196c503b215294059afb955
MD5 7be05c98b8b3319c53e4a84294003943
BLAKE2b-256 f89f7107a23e95ec3589db38eb8258959f4030e611f1fcc5f386330fa8802a69

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp38-cp38-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2acdac1f8e49aa4d43904c698800726cbe125def89f0489ec1d3db7584b7e1d2
MD5 e31e61d8f3e08da2ec9d732ec36ecd80
BLAKE2b-256 0125aca0b9f5962eda5a3345b262e96c3c7909b920dbc30f4c8f9c3621b699d9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c06f0dd9915e21d0023ebac75de67f43505047c6e4beea626849566fe140e855
MD5 f21237b9f670df20599519ed25f52102
BLAKE2b-256 42a06c1a6ad62dd907884f422479801644f8c178fb836b845b274c762951d130

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403251711221216-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b07249935b32ad520423c39ce31cb79a12fae4c9e0906f34af23f57a6d48bdba
MD5 38844a8c198de1bd822f5fe0b4abb1f2
BLAKE2b-256 820e2a192628119c274a7398c8d33b473869b2b6735d65c9d882c927bd0253d5

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