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

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp313-cp313-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp313-cp313-macosx_10_13_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp312-cp312-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp312-cp312-macosx_10_9_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp311-cp311-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp311-cp311-macosx_10_9_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp310-cp310-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp310-cp310-macosx_10_13_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.10macOS 10.13+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b7519bdb6fb9ce034ed308e7b83f2656b4532814d337c7050773ddb78cbee6ee
MD5 3e0d539b34b043dc2eb13cc2c4c6a6c8
BLAKE2b-256 13a070053bd468e6bc32170d960434a979870da68069050e5ff2e0ce7e2d2241

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2306842e689caae6edee07caaaf288947bf8372d79c7b9652d1fad7b05eeb1c9
MD5 dc1422f6fc43b1e80f72f59ee8b3ca76
BLAKE2b-256 36ac953e51ab36215e0efba79186690071b51dafd63b9f06b8a9b5d7953fee4f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6a17e8132daef373b7837822d0713b6475f02e51fd3b7df286c15f873d06e16b
MD5 28cb393689d4be09410ba131fddbcaef
BLAKE2b-256 2cda0dd6ce4575acb46f2dc6980b588cbbcc34586bc8e7cdf2b049471f012c13

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 518fd1c2cbe57b639dab9545695913952f2fe73f6304bdf7d874a67911b1a495
MD5 e162baca087e016f49784a5f013f1b51
BLAKE2b-256 5ecebbdba325a38ae8e4d6c1bac4a0a5468de2b6f1acbd4ecfd46139cbdc87b9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 cff2b0fadd02eb4d60a6eef4b3ab6e2e71ada89d41726a82f82b4b7ba898bb22
MD5 2bd4e18badeb8a36e5d1e40bfa3ffdeb
BLAKE2b-256 6b0ef80a501e79a65cba890b485809ddd3d15268cbcbae096325c24b04cf88b6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 c130fe66f01635fc95e86749ba4282761e5b8901c9e7aa28bec4dc206801fb07
MD5 cacab095850916bcffac3952d2d2eab6
BLAKE2b-256 0431239cfdc080239b9a4dbf70d50bf33dc10b931cfd852834eaef83c8cf944f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 95a0b0c392b25dd5cb08e9eba1f0d9af7c5c97c223720fb6905670a98b8f5dc7
MD5 3f856dfaf39fe6a8975d4b99a5052e44
BLAKE2b-256 09feed163305eb023c9eb9216290bf5226b6bbbce4de01c57891094d2aa4fb99

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f1710cd30a193eafb030350599d72de04208497f22b625911fd46fc8431f592d
MD5 bf6b540a52bd79295ef2b9e093e2f4ac
BLAKE2b-256 9d0011f49262f21a3d34c5a2d622f64fc375eaa3b4d13ae19b0d2373088b1ec8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 54beb2818344643c0cb0b148324eb323715b24ad5616deb7f30550d1aa1e1738
MD5 3bb22876f63522eb01a87d23f6918681
BLAKE2b-256 4b426bae5fb287f044aebb0e9f2b070af3cce506857bf4690782c46cf9b6db4c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 70b37d1d9f53d002353f5a3829d09203937f16b8611950e3390273652b69b695
MD5 bdc54ca112224a0801d060f7e14dab09
BLAKE2b-256 d485f0b3306639c4282844a75fd523f9601c080b3ad455386258b16b14629ffb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 714dc0be1c3a9e6edc80cc4b462f603dac358456989db4c30dddd788adeed344
MD5 f53071e4788ad22c6ccd05b7b938b86c
BLAKE2b-256 c67a0031b4d87002e87999b993ace612737508e34f6b7d95fdfebb6a6ab0d0ea

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 71ba531c3422a0ad88ad42c5c33836189b0d4b90699fff39d18a645fa044f035
MD5 49727188984373664b558de4860db3e9
BLAKE2b-256 b2af8dfbe45131d490eaa0ec1d93dfd3ffd1506b2666406874cbb92f4df1256f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c43133c06dbecb5e8a30a0f9fb1e307bc2f25ef909fd273c4d54bc07d92fe731
MD5 7cf71edb90a693fce340990c3746a9c8
BLAKE2b-256 0a741589a7780f8364de299a40e2ab72404b9f4a65a4dd169340a1246b6fc334

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bc244ea4f276af76205f2387312a522643d4ad42951e2ff391b4776ccfbbae69
MD5 3aaeb85b376cf382b6c4d0bd5877af5b
BLAKE2b-256 ac0ee671628599c475e9e1ebbab2fcf0d7b0dab40736e6b474a86d9df456a796

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4fe8709cd5459660dd2deae629dd95831a8c798b9be7639df607f662033c39a3
MD5 5ed0f728b2d2ac237f5b127f4cd0e090
BLAKE2b-256 79ab8149633c080ba9f0ab0b8135d2e04f2833d0a554b1034fb4ee138ddb300e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 9f44da98dbdb9a93c90c2d07b6bfec6930ac5a2aab00d38249a48a3ba010a99d
MD5 d714b8c424109401cb6c2708fb9c51eb
BLAKE2b-256 74d08819b360a9c50d09c1f26d5a9f64f7590d2dc2bc37a0545518f7154de09a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7474460857fa895ebab346198ae181d73645c9c363ff80aeb6e3445e1258d142
MD5 b901dbcfffcd94807e7b66e8a81b4ff2
BLAKE2b-256 28ce1de003a3f3011057615fea36b4b39811cc3a4dbf837f200c35d300e0bd1e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 853f125a7a6136e88f22173d2304b8065e97c6f143cdf40ebcec10d8c3a66f36
MD5 c3b4f05f7fbae1b8b0f398b698061c7f
BLAKE2b-256 ada082f8d4bb7eebaa8bcd9700f36c358914af627757576ea61b8e161d50cc0c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 49d7bdb9ae4f8d41128427c8421b4198caf3919ebfe170d238c1acc204071046
MD5 fcb1494aeaa859e200bc141006eeb812
BLAKE2b-256 1394964ccef5865656cf4bec4a8f4e416c6fe92d246de779b7eec575ba3a4e8d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp310-cp310-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503151739452835-cp310-cp310-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 85020603ec7d376f301210be82898debdc4f3ef3e7db910248696b82305f8efa
MD5 62f9c2b48bc74f5e128b7476de7fa408
BLAKE2b-256 e56fde9c473ab34531b6142c1c6c3924c9f70cb6973cc7c78b666a02bf183844

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