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

pyAgrum_nightly-1.17.1.dev202411081730930665-cp313-cp313-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.13 Windows x86-64

pyAgrum_nightly-1.17.1.dev202411081730930665-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411081730930665-cp313-cp313-macosx_10_13_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13 macOS 10.13+ x86-64

pyAgrum_nightly-1.17.1.dev202411081730930665-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.17.1.dev202411081730930665-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411081730930665-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pyAgrum_nightly-1.17.1.dev202411081730930665-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.17.1.dev202411081730930665-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411081730930665-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pyAgrum_nightly-1.17.1.dev202411081730930665-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.17.1.dev202411081730930665-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411081730930665-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411081730930665-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411081730930665-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 018c2a451f8dc4adb85076226cd3d7738940005467b7c1605c10180d9fe7f90a
MD5 8844a168c8f86784f53b0c09beb68c80
BLAKE2b-256 dc015af8191e082b7ff8f663eb97799219a7e5c7d90f6896cc8550c8e90dae69

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411081730930665-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411081730930665-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bec99a0a82e6527f85089381419a6d32e4e6bac95744fc33ad12584b880cfa7b
MD5 5e005a3d23ad53e455008edbb87f8650
BLAKE2b-256 c97d127714e64413bd67b3d587e11b20552c3ae654f53801db3b8331c84fe46a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411081730930665-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411081730930665-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2fe1aff44013a30aac2cf037fab17e2d56678962134032bd43c96b578e431c37
MD5 417349d31abd79421e2b6f0674059aa3
BLAKE2b-256 249994d9e292c93d502c1fb48463e1dcd3de6982250ff3b188d8a864a1847683

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411081730930665-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411081730930665-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 42d978fbd4df3a822db891783514efbf953ab264f608ce306a6c00e4b3c868ec
MD5 67792a1bb0fb16e9038c5175d523e83f
BLAKE2b-256 5ad9dbced9a9052d50195a05e9f4a4fba6c692fd8d9e0f5e59a6a16a950153da

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411081730930665-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411081730930665-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 3dbdb545a1021b518eb87b7d5c81875e4559829c6025f70e30775201942427c2
MD5 c8037590e011a02a8107c45af8b83170
BLAKE2b-256 f9ccd9b8639e3eea4fe8d9916fccecc375396877e0e38e14cf3666c0f3c5317c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411081730930665-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411081730930665-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b363040b6137ff5006a98a68c952dba954297e69ad6427e2cee4ddbd4e990d45
MD5 48583c0040d4d380d6f788217f978911
BLAKE2b-256 1cf42feb8dfed57deed08242b74d4580337474ceb7cc4cd76ad69cf01900fb20

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411081730930665-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411081730930665-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 83f3fd30fe6f22bd6232e86d093df3ab50812067b2a218b21b91b3497ce49d4a
MD5 a5395ac1fdf43184b75ee107ca0787da
BLAKE2b-256 f4ad8897642635690a749da16fc4ac98e4f7057d6c3db57c4a875e42eef3ce7f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411081730930665-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411081730930665-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e54925ca340cb1c2b9126c2fca9a6fdd448cc626a2c35b72397a8c6d2991939c
MD5 5cf6523f2b4745c9fc419c2008503259
BLAKE2b-256 85c744739d04fd36ed0d62c0aabb4aa22b288f13a690d760b5b3473cd8e4e224

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411081730930665-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411081730930665-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 18432103dac41976adf24ead663b7997532993974bde2a7701e166cab1656c52
MD5 217bffc3b10b3860bd3b1123a159853e
BLAKE2b-256 729225d1d9ea03bbcf1a86011f2824852b9e17852179008ffefb48d45665bf72

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411081730930665-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411081730930665-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 79a66446e720aa1e03c3a4afe9299d950b3e9ee98be81aeb4e93221402b4bed5
MD5 3fada3b7519b19fe869d13454e50fdab
BLAKE2b-256 096cd2f697d71598b9f0fdb699a0322fb585f535032c620448dc5dc59aa462a8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411081730930665-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411081730930665-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 6337bf8e7a103970262cfa14ecdbe768f8446958a148c38271aca557df9b9996
MD5 b4dcc5b44aea3920820653dfaaaa51b6
BLAKE2b-256 344d377c7f001fb32fb90995bdc85923f42e7f2469c665e6c7e80369f0444ca5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411081730930665-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411081730930665-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 426e6016c2223626a654b51bdee00d31dbfbce1ae7d61f9782d21007ee2531d4
MD5 6582a7a3db6021d64ece4d805533c299
BLAKE2b-256 8690120252193987a12d6de87a622a5a5a78dc31078a75bef84ae21005e76013

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411081730930665-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411081730930665-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 edfaa4fa198e82e325ac30d02f8de33bb77733004ad47e9dd6fedcfeeb25a377
MD5 1836010f723f42e3031f97d95dff1214
BLAKE2b-256 d8ae790998066e9e1b867cb3e80818635e4a349476c6e772f5d61817c83528a8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411081730930665-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411081730930665-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 15de478e71a71ad29ca4c45d75b7929747a125250463aec4e7e6957e591def6c
MD5 ab06098b96a99bc34b85335d2f24c140
BLAKE2b-256 66526b3d4cce753a50e3440962b999c7766c64f3166d339f8a4b332e49e3356e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411081730930665-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411081730930665-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e208bb67f03563340a9edec53e30a5ab178e0d83b195931c71ba49bd4ee37c57
MD5 52ad66c040b6466a3a498cf4c04efc0e
BLAKE2b-256 9093b76bd0e0f83bfd83d682129db71075021d6a06ed83d7c2d28000ecbbab1b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411081730930665-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411081730930665-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 aa2d568e89ecc911920f1513747d69d235dac54121df4b572d3ce506caf4aaab
MD5 9a57775bd50b969a98934c74a632de5d
BLAKE2b-256 bf45ce2f78096f3432b663a5a74fd8a2ef6aacd08c39d5fdbf45952967c4e686

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411081730930665-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411081730930665-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1dfa54492e159fae88ade5c1e882791fd53f34379d13759251f66e63a8771187
MD5 fb0bfaf4e94a41a635b8942f5263b7ee
BLAKE2b-256 8a33b14357681508771456b14e414bc75622f8ca0890da883a337fc33a34919c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411081730930665-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411081730930665-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ab7ff347d6049eb5db3887cb1af2053fe712ff87ba0b0ab13144792d67e93e86
MD5 9cede861138f3a2571586c819679eeb5
BLAKE2b-256 bfea0c42679ca02fd8d06031875d6e2c204277348bad3ee3c18fa0ed33e82adb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411081730930665-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411081730930665-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5b42afd0ad1e76f293c75d54d235ff1f77a965e26d996a7fbe0340cc6733bb2f
MD5 02fa3315d8db23777f15d6ad9e8b9125
BLAKE2b-256 844720172026bca483c2c578e1b21146317cf6c9f71bf523bfa67a7827f17566

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411081730930665-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411081730930665-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ad3957f0a1adcef2877d6e669b59408500e594840e1f4760faebb9b97de36823
MD5 658a1399b9ff88e6d289166ac85b780d
BLAKE2b-256 09add375fd6cc50ea55e39eca5f57fdeecf10f065ca3607b2c291307f7caac17

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