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.14.1.9.dev202407151720623864-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407151720623864-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.14.1.9.dev202407151720623864-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407151720623864-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.14.1.9.dev202407151720623864-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp39-cp39-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 1f2cd9c19076cf48855f182e0de21eb452b8f1ef9f5f4dbb9f34bb72f687439b
MD5 c59d52c89f61cf4edf9db4e256361b09
BLAKE2b-256 1ff0249241a5cad99f8622f064701d3307bf0417126d22dc18ba014c0137e825

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9766b410742cb0a63638611115ff065070caffc5fd7d62f79ff6f2a726c1832e
MD5 25a80db38c8dd1cda475acdd7645de3f
BLAKE2b-256 fad8cee8a5d7de6dd36accf37b31cc0af4dd0d9cf61b42cafa303598dd810ea9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e0b434e6124edbe60bba9060430a9f25050629507407b9de1c2719f3da837583
MD5 2b42bf47207fccb2e1f2ece2bec140e7
BLAKE2b-256 91ab03fdbc825011d8d6b9b6533ee854d7f044caf43afa0471c83745b5f6fc3b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8e777d01481dd7e394e5a985ab69d5d912594147bfd7be9eb4f8c5e5da233d55
MD5 7ac2da457ca0b60d6059ee8c8311a858
BLAKE2b-256 912317e24628a7d85eb2161f141c9410ce158f4f10968579299586f6e93be5f3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c542e53e3d1a1493e3c6bf9d37cbdc0de2ccd6fdd9930d7db7e28eb1498aaa93
MD5 fecbf228351be0d8e93e3168c060c534
BLAKE2b-256 3cd127e13b101091da4c7b8697b345b0207472ca12baed255c8fda178b46da92

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 389856e1657333b932bd462565fb694b4d6e209ee057b95ab1fb1a8558e8a7b7
MD5 c414e01904dd8aa6982dbbe577e99162
BLAKE2b-256 966a8ad32c3c12144daf3d82b9bc77742f78b153cbb3ff66ccd7bab41a462d3b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2d97646caa2e3b8f425b913591e38204d14a74e0a9eba2f2aad58074af4c3175
MD5 7a5208ba0d75ba85dd489402d6b8c74c
BLAKE2b-256 cfbcbb25b61b09c365a11eaa23e64ed88b4eb50f3eff69a367aa2c40ff709e1a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 668e6c82e8bb9f7e739c47f19efa5a189c153fc90e306ad554870b44dc0d1299
MD5 9fb7d9e31adb15a68983182c06313c89
BLAKE2b-256 bd8c833dd6c65b779ae28ebf7b7649fd2fe8831f21cfc8ac54bfe888fd7521a1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bb967068fcb3ecb3e94fdfc467c327ff5f7940e9b50b9117c171085c3a99a0c5
MD5 9bfe80f1bda3501731f1007232f1c5f6
BLAKE2b-256 fab64e5a82c58060e9aa657bc1ba4a65b7f23c14e0967a538dad817f0056208c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bac25d533ac0d6d8b44b1616cb56fba58affafd808deb4dd19cdc0049fceb11a
MD5 0c0ab7e57501e788f736ca2b78d69cf2
BLAKE2b-256 5cd69a5165409e7758c26af77f932b21661475fa7919ddab634ef555817213d0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f53da2a37eb5a1fd1f221ef6d04085922b027373361cfc2f381dffaef400defa
MD5 c5f8088cf1921ff682b3c58bd4d826e5
BLAKE2b-256 695bb8a26dc25db3f054fff9efe7d5335b90b6b2c8c7ccf2f14b23835cdc9b5e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5dc15c2b5b183fe98e61438abd7a90d29d94bcca5a6962914154d4272549a36e
MD5 8102a118e8f62640bf941cdd287c99ae
BLAKE2b-256 0291466bf4bd560243d6288d4aff5e0eefcee75cf3ca27be36a2d728d6ab9fe4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bb67a2331e88cfa64e7c91d6497134d66c579c5eace764e0421f3b55e5b24aaa
MD5 c441c89ddfcefdadc3314e41a93bced7
BLAKE2b-256 fa9b9fc61c85cf1bf5dd075743698e25d405a422da86963bd41bc901171f35bb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f3854ea04a5c0bc87c7119e7e68abed9a20a567f3a3f9ddb1ab7fd8a16a153a0
MD5 98f796d88e3c3665fcb0aa24adc0a375
BLAKE2b-256 f5d10f83d8fe13fe5ec9df41e25b6e203b35185867edaeccbc03a57513117bf3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6c12e06ef9ea55d44591307c6016906a91593c5491b1d6b16f1c5909e7946cff
MD5 89bee93edb1796789b1c43cf3650f3b4
BLAKE2b-256 bf47b1ed4da4a203db54269c47afa302391098a58d3f91abc878b5caeef9fdb4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 1d01de44c3dd0d052f1c561d82399c577d308ff68f40343054f4bde32341b2ef
MD5 318c770c47778c2a09600ccb79692cdc
BLAKE2b-256 6c668c563cb8e0abe9898e848340a27f7d12f872634db73990c514d613695fdd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 06eb730dd1aee1e7417c8de876dc2afeda768010d0950d8639e0b1f35ad77078
MD5 1ec7644e7d86c51e681739e06d29e644
BLAKE2b-256 2a575b3a60bde2a5ee65ce602fac9e7fd20547e9d726350cac7f771b66d88318

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8c84910528cdd145b1022a1ea6107280fe8f9fc1ddcc108fe559506503aa0563
MD5 c643c6bfa103f1712868c7b8c4efef87
BLAKE2b-256 88e3e1a2307f11e4ab7ee9ec6554786a23c6cd51a227e3b30ee50977c8355d58

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 437b5bf56519a7765cf7ea7ad1ead13d51bb2428a1c43a979ae75c62e63f2220
MD5 8bfd3d277c3537d55e65f31315b46d17
BLAKE2b-256 58710d73eff0e9fc0ddaedd50b8b6d1f1eae129683f6b720f314acb84441f2a4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407151720623864-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 cecf6e660d589ff5f0fe36e3bbb610af4eddcc4645ffa54b1390b88332f515d4
MD5 7a23abd44dc9cf025d7ce4369eb32774
BLAKE2b-256 00d7d078fb4eca08e56d9e5ed08401b5d3fbb3ff60c8f16cce332ac3dfe723bf

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