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

Uploaded CPython 3.13 Windows x86-64

pyAgrum_nightly-1.17.0.dev202410281729615378-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202410281729615378-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.0.dev202410281729615378-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.17.0.dev202410281729615378-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202410281729615378-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.0.dev202410281729615378-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.17.0.dev202410281729615378-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202410281729615378-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.0.dev202410281729615378-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.17.0.dev202410281729615378-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202410281729615378-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.0.dev202410281729615378-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410281729615378-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e0513e31aa5b1170f110085523a186ee2a114acb7257e34d854778f01dd7a861
MD5 e3a845522787e6dbec117101ec9be0bf
BLAKE2b-256 7be0c86bf231d16d72b562ca78712674e31cad3c50fc7b29b887eeb288579ad4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410281729615378-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410281729615378-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d0b9284a3bafad0446a9652b628083aa91460462690e9b37621a32cae8b3893c
MD5 8277cac4748285b30f00556cc8284885
BLAKE2b-256 f86b0f6a77a0e95de102b46cbf3327855f7e3743007fc233cd4e71be5a4a619a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410281729615378-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410281729615378-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 797f27b85482438ded31844f23fb85145bab5ce0b4159a615b8c42fa45f69165
MD5 c3afd9d5be4c32b5356981ef9b226b8b
BLAKE2b-256 b975f19f6f2c831d50aab4107cefb0777ec39c4b05484cc8d7d9e734ea22ba1c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410281729615378-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410281729615378-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 80fcdf5be9279a57af91eaacfe3498b63d7067ea422f87b51388130097587b94
MD5 ff8168df704abe142a4d49ba6d027755
BLAKE2b-256 f47a28017e99d04b1e7f8652f808da5f5b40bf0e502f3fb761f4a57c4a06d4c0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410281729615378-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410281729615378-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 bf1ea1a0e2e36b35fd146d87f06da7e13637b4cf1d3d3c0c83ff55ad4d631eb9
MD5 85495591a05420122814cff9d618095e
BLAKE2b-256 e097f1573e7768364437b235292d071b2fca20205e5df0892e9fba16084372a8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410281729615378-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410281729615378-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 139e24354d272c379b3a135b9d21dd5d45581ac3d0b7e04834466a7c11f03273
MD5 e8ee195da41316d0ce0c3d98800cd4ed
BLAKE2b-256 e5622b537115f1491c573600afdb1b3446f108efb41fe4311892774802726b8c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410281729615378-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410281729615378-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 19b1a032ff1ba33205a60c5b245c76b4e1f3a629f1f7257795a30823348d27d2
MD5 175f569a68517b7659d0f2f1125f9714
BLAKE2b-256 4c0cc3aabf371bf284668000b83e786e5c03253dee07049ad2ac56f40f1b705e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410281729615378-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410281729615378-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f8834b5cb06c4f6794e46b62f9738edaa2df10025018a0cc183548d228a3bda4
MD5 687776ef444c8daf598a43d1efd93fa7
BLAKE2b-256 1c8303ad034b72fa9cf99b1732a29602ebaac2c9dec61298413da4db93e1430a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410281729615378-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410281729615378-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a0caa3d78e21f87a79ba7171b2fedb8828509dd424cedd5d1a84f06d1e1be954
MD5 5a8899f6caebdb36d26f458301f50d36
BLAKE2b-256 e70ed43ce47925213b900c9536ae0e503fe40de1c95d0a1e11189050ee7c83b6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410281729615378-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410281729615378-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 21d4f7971ff25056f37c8f5d804ffa8de8ac415354ecae58178a0b7b681688a6
MD5 6d545429494940d25b773d19d44a6b3c
BLAKE2b-256 18cc99741de44aa7062a5e25f7f90c559ceefad1fa801787574a9efb8c98f8c6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410281729615378-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410281729615378-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a16cbcb58e6aa5b27a7b012a297759bb759a3ae6070c420e094453ba6d9f7750
MD5 af8dfa26be3f00463a3ea41bc4660fb7
BLAKE2b-256 e02f170d819deda7d3565e97ef5f3eec724237d6e7993915745d14bd07aaf865

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410281729615378-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410281729615378-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 86bc063492e92c00e87328634f4a902fe1266601b9ca02877f4fcde0d3b46eb3
MD5 10cefd6651f9b9d4cfbb92db313f6eed
BLAKE2b-256 3ae0d88b1647d04c56a1d7984cbe8f0afa1831e6ce2256fb4956f8f6e5610f2a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410281729615378-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410281729615378-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9dbde799b1b757c6dd0c89a699d74184323b0be0072bd53cef569428ac96cf54
MD5 c33839636adb61d674bb16338bf25d46
BLAKE2b-256 7436e1f199f30adc636cac3e94066dae07d77ad7304f9b21b5333567b9e41bd5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410281729615378-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410281729615378-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 56b4dbd946c2a6e354e97bbd631dbf89dab7dff28435352c616229f2da525da3
MD5 8d63731256c8e769eebbb306e548b78f
BLAKE2b-256 2dd78e54c170a26cc1dfaf364f690269835a10e666c7aaa4f9eef99e5247626d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410281729615378-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410281729615378-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1c5636be6f762f36523b2542742ddf0284bcf70447c4f7d3caf33c1770a9237d
MD5 158e124dceaa756c6f4c44e6a2e88142
BLAKE2b-256 13af53c5f77eac1c06cd8ce5db30efe118da73b14ef0d5666e537e0d1c15e6f4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410281729615378-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410281729615378-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b6f73f1e7e4abf9492c4af0886f1e8f3d18c1c1edca921ad2f012317e33a732a
MD5 d73bce08dc95d45801a7a72bae770d24
BLAKE2b-256 f2a76f08d3ea465bd8062eb7cf64b66999227493e5faf2d2329bb6cd91ea99c8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410281729615378-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410281729615378-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0f2156a0e317678a3f4aca990a47168668f176c63f9c38b74bda3bf12a3c620f
MD5 f3a60d5b8a26acfaae45218bea6e1769
BLAKE2b-256 e404e40a74ab13067b584bb665b79dcf53a7b161db9308d64892cdf6c840ef3d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410281729615378-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410281729615378-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d3df56013f2ca8377b143ea57d1d6a1094e624df7d365500a46531b4ca70a6f7
MD5 792b54abd7da6f3b0d79de7cf4e8370c
BLAKE2b-256 1e8bf295f90570e79c25160728147b358320060e8cbd459128a5f70674ae5809

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410281729615378-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410281729615378-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 27ed29e56e8aa5b419a161fec7ebb842ae9c6959c9b74b339ae71351958b548b
MD5 c2e1427bc840a62288407e609dd034e4
BLAKE2b-256 dfdb58a01c9097dcd9547fcb2e4e7fd8a4a4a9d83e6fb9a9c2294ad143083aa4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410281729615378-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410281729615378-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1d818e7eb823cf1e36f8dc7fa44145210e79de41202b0adcf95c004657c58e57
MD5 5bc0779553513ae1929aef937fcb83a8
BLAKE2b-256 7fdaa3ce3d160834a6518f953e1726b58bcddd5b3f409e30bbedc1a851ab405d

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