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

Uploaded CPython 3.13 Windows x86-64

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

Uploaded CPython 3.12 Windows x86-64

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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.10 Windows x86-64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411041729615378-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 6b11b3679d16a316a5861663f9fb0a2ada86498e98915b47ac5dad006a0948f4
MD5 d26a3c49e605b1bde0f0c01d9d63852e
BLAKE2b-256 209fc443d34874792ab5634e9b64583add2fe2569fdb97f3c2372d761bd297a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411041729615378-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 53c0e927f8969e2b330764b35e1dd3f1fd00bf09f49b8f3bb93ce7aa824205a9
MD5 c1c466594dae84f580231381e138b5f5
BLAKE2b-256 9e4538eebc3638e9db1e00b86634761028b5ff38c10937a1d7710480e43af2e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411041729615378-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0cda45e05a7bdaa9e8edd9b11932cdce00ae83311caa86c21477aa3165ac933e
MD5 33c4d0338693eab0dc72e6226490ed8b
BLAKE2b-256 90c4dcdf4af59d408f2a43eca872b7bc7965bd9f2d6a647079881ca340c177be

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411041729615378-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 75d1859e0df9c762fa941d3965d4d6f277114e76582dca1706f82bcf92aa86e8
MD5 c8ca4145481cb8cb5580ca674f665e0c
BLAKE2b-256 1998a60891ab49c5cad493786d7eebe6aaa4848b28386d78a6d188bc5709a4e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411041729615378-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 8afa3494027c8906fb970c27586b3c2d43f00ddb8159a3f3fd013a885725c540
MD5 1fc679b607a297f413233cb211d7e658
BLAKE2b-256 74dd595cd71036410c18d530e7b702da76e162bde9ae050b94ba14a9cb1ffb9a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411041729615378-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 51fe7888de42409d9b82d45e5c382e7e832e33d69da6dbb721d889e7028494e5
MD5 414ae912ab74f170d131bf2492e69f47
BLAKE2b-256 ca0af3c8ae53b5bea6fb76e1ab730ee9de4896e0588368dd398f028b8ad544b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411041729615378-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4066a59158020e9a916561fe2de2519c4868fb4ac83416fbc56498c79d1d893b
MD5 60f6b3986d9f081b8898a1de9a6b67dc
BLAKE2b-256 8c98b9596baed1d44114797bf6005e323f0330606023b1966e3512982a53ea08

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411041729615378-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0b2f7a401c5b01cdfec1cba523fa8dec1e407021be789d51c41e00c160790361
MD5 e79f7b6bc1afd6d087199b0d675a2ca9
BLAKE2b-256 e197f97e03d7049842c7a246043f17778dada2239a5ea64c4f760126cb98ca6f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411041729615378-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 74f5291f0b7c85b70a6bacff33a3ec2f05812b18cf6f8774c0f991d71f8e9ad1
MD5 206ba49e3576a86999050c6914075daf
BLAKE2b-256 50500a499bd91f7b4c72a406fea20a94ac201f83e1a2898122a843ae7c7648dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411041729615378-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2c151791eb110ae2b330700736ebb558202df5929a90509c273f3c4ea25d5656
MD5 be0a19cfbd5593378efe01cd1a19019c
BLAKE2b-256 8e9be0f03f927cf5120f970320e17d4872a82263c0bf9eca5c68a94c7bcb6bde

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411041729615378-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 4293f881c1fd1826517bdc7ad63134782627a388be8c4fb4cf550d4bbbf00c54
MD5 9da8dbd69536046beb5e7ca2b4168e89
BLAKE2b-256 3749f7b49517b9c198d0677756e7dec76a73f206a2f27d84cb4c34b8638bd0be

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411041729615378-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 02db97414236fcabf934d77219c17871318e6a74014be28c0d198849996d188e
MD5 de4fe96e2c60e1c9a1eccea2c3fc1cf5
BLAKE2b-256 3c8206cf648a76361bdb18297b7b8fc48623e71b63f425c58a0edce30cfbd158

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411041729615378-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 69d62768316336a83631741a3954132197dd80e2da6f231ab549ec1261086b52
MD5 e77a50546dc2dc158c8267524d5469c1
BLAKE2b-256 9ab0cb9a9f106d931d0d1bc798fc709c06994fdac43a17928e45bb9218ba8316

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411041729615378-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0fde89c4d71240282c9c5a9ba0eca45035a70c97de953c69a1cc872ab86b85e9
MD5 9a3bbdae0c977c61850c10fa74bd1a63
BLAKE2b-256 58189abf83031eeea8d71e3845c8b5e731880c42eb1529d7f783532c62237b92

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411041729615378-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 04996636cfe50a605b006b0e693a81a9f197f725eea575b31941b9d8a7298b5c
MD5 6ad7b529ca5efc994922625cba393551
BLAKE2b-256 a20b9979d6cb117ba34a95da53225c187cfbfbfb3c23e92270325e4914f40bf4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411041729615378-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 0570a450420ca2c0a787de28c187004bcfd215cdf53b22107773823d4c049a72
MD5 2be99cd7e9770d4c9a0b5ccaf7aa5173
BLAKE2b-256 c66bee389e0d60cfe8d2502d2663ca361e181befea6ae0f16783d6fe81b68d03

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411041729615378-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b32cf842a0c1706d42422ecb0b788d6edfcad9ecef2325a4268daf73b7eba788
MD5 383b07b2a4614584d2c0028a539f54cd
BLAKE2b-256 5ec9950da16268b75cf6e1cd690f8e12c533ebaf6fe595e5aefb0459c63299e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411041729615378-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 94587ec42230c87355270240bd538eff0696af76af0fe9630ca2ac89e8260c14
MD5 e26a5c43e5ca7cff1683c512d03db134
BLAKE2b-256 3749269de7b96008b17426db5b4003cea84d74b32ae949f08b8e3940a0ea8df1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411041729615378-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cc4fafd67adcf199a5e353a2585f836c0f7d3c2a82e0edea79462e6669a5e2fb
MD5 f15cb97834804fd06201de33d8f84c1e
BLAKE2b-256 7ac2341b49e719882c7a0602fec9387cdecc9aec07dac98fc715730074c1aa02

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411041729615378-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 684792f076a88e0b2ec2fba30d10f124f2b832e75a62cd28b546e8a7fc811eb3
MD5 a7afbd4b5212be44840d8fc31f678237
BLAKE2b-256 be5bb79278f388ac8f46e5362fa806376f35454876ae31fcbc4de2a8fce20dcf

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