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

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.2.dev202412141731932516-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412141731932516-cp313-cp313-macosx_10_13_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pyAgrum_nightly-1.17.2.dev202412141731932516-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.2.dev202412141731932516-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412141731932516-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.dev202412141731932516-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.2.dev202412141731932516-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412141731932516-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.dev202412141731932516-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.dev202412141731932516-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412141731932516-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412141731932516-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412141731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 566a8f41e2f59d5ddb293a013a442231fffe73067bb5bd6b19c2207e6c83b4b6
MD5 85dbbe63b12ec583d085ca91c64e5b0e
BLAKE2b-256 1a083a04931f981202e08165036f9c8038514c8ceac770ebdcc243d159884403

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412141731932516-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412141731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a56dd3dc1c9a993dd111cbe8cd38d3fe1bc13285eaea5eaf2ce8e9ca848ee8a0
MD5 22478cd68a6b4cd3475339209aa211e4
BLAKE2b-256 e9799bbfadfac81c6db819552734aa65b84ee99c89119aceb468c84b1b980a65

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412141731932516-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412141731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4232c6d2b4d15f641c0fdbbb8244a6ce626f8c15efe1fee98857dff15d3d9da8
MD5 4222962f05f53237fe88d0b448094fa3
BLAKE2b-256 a7c22c26f5dd9db74958a1388e3fde1a066649641620d23dc1e3aa5bc105a0fa

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412141731932516-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412141731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7fb7e29ef1dfbf568264592ab340cc917ad9bc6b4e113bb080e8cba073aa1ad8
MD5 a636488161003b23e53499f172b3df77
BLAKE2b-256 f589e29c791a6f360e0c689b5e915ee0d18c807dd0527e84cc2dde02ff9989cd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412141731932516-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412141731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 9fa749d8f2cb0b441487bce0c152a04dee15f71a6b2d3b7b988c9c25a223b2e9
MD5 fa14a55c08be7ba879507845ac6043f7
BLAKE2b-256 a360c04b63e664d8ee054153a68edb940830d36ce51ac38fae01fd2add669292

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412141731932516-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412141731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 6fad229a466272446b690827b199f7c0773e8194a714f0a37a17643d6d927e22
MD5 4c7eddf34c1162411bf0bae1a429a99c
BLAKE2b-256 0f3a6d91b6b5d34e88ab1d6aaaf2819edb885178a4e90ac8f27f70fdf102a20e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412141731932516-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412141731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e8e6a00f4af53c4fa7ea00553da5ea7f20e3e059de2d06dbfadb2cbbd4034214
MD5 efd935a0d94a8fecdeda85c36719cb46
BLAKE2b-256 1dd31892a545e91e570457267e2bb49a76a5c1be89aa838bd8f57816cb9ab628

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412141731932516-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412141731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 502e73a2eaf91e5c2913e4f9265a128b7ebfc28a9c2c89f463f88e2c79b5135f
MD5 90b5b2ffb9fe07d5f4f3b6e46996b8d2
BLAKE2b-256 98173e2a4123b1ac8aaf8b3805dd942dd0224618a925a0f6427ec66266c7437f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412141731932516-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412141731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d0dee46c879667bf9922f33e3aa8d2e45c40c0fbb19aac402b8211dd7383ba8e
MD5 70214b8d0ebee5e8c12c7f2071b07a3c
BLAKE2b-256 f4c9126c0c5485f8cc615e5870735b92e4950e0ba99df0d2183f62031bb1ac70

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412141731932516-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412141731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e2adc7282675324d0fe8f8867d9d62dce574da8bcb2a80a6ae7512715586fc8d
MD5 f20fc88416d709d3797f7725b058111a
BLAKE2b-256 76db733c90f988bdf3ad538c39e4aaba954e305ba0fd2b698d42ed84728b475f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412141731932516-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412141731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 3f88d2d4e8825edacfba83fee4366f06caf1f29e38560260cb2a8b09a4f34d1c
MD5 bdf92d4f959356c66c4b83e18d40338b
BLAKE2b-256 eb4eec58cf31f9cd4c17adaeaac8d0e74fdfcaf57c9f306464f354c959de1347

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412141731932516-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412141731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e837f4665c3ad96b74b9ad6aca57aee4746c7880d99fc752a6ea2f60c5cd761a
MD5 4157e12ac2ad385806d0331e57d15c70
BLAKE2b-256 85f12844b04cdb4fee2b3eb9c6ea358b45fc59d1f9057f5f2572b0ef0c62b4f9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412141731932516-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412141731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f4084711e43c3abbc3615517f6c3984a503bebbecfbd3e92844f71f825051548
MD5 7f8c1b6f5ff5a6dfe599e2388c66dac5
BLAKE2b-256 7a5f05938a0cd866c895ca0d39bbade5603de89c9db63840c2a202cbe7ee05ed

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412141731932516-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412141731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6f9f2ecf75aef24e8ace608bdcc53253dcd4125f46b001b8d94abc35ed2d9a21
MD5 f03c7e39f2f68f4b27b77fda72e1c634
BLAKE2b-256 d4e74461c1f64fe1193b2b393c79ab41826b20a158a44bb7857fb24e94187041

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412141731932516-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412141731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 93fe5a55bf84e1e4798b25230eb8701bad87ab18f1f3c99fe0cf4514b2199f8c
MD5 2acfcad57ea7df53f2eb1ec8ad60674b
BLAKE2b-256 23d0295e695a4d7140542ed3c8fdaa3f7ec721c6e98c5d37ab4e72210ef73508

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412141731932516-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412141731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b5f29752ac41683827ac3402e06311e01ac5290277c50f42e528bcf871d9729e
MD5 15feb3b07d31bf0ac617a34a9c09d9a5
BLAKE2b-256 28efb92d7c4627e164d699f92574ee3b9334790adf4d44da199f0eecc43c5269

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412141731932516-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412141731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2dca111760dd404821eca8ef5863f5e126aab345d389da0a04ac375a6a307086
MD5 fdd82ea7b7cad0389968fcedcc72ab0d
BLAKE2b-256 9984deaedafa5c64b4641a4232910f3d339d21ea566e292065d5710a3137c85e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412141731932516-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412141731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bc19d2d8fe2c3ca66572161d73c55500094b67a5dd64c20f41167239a563667c
MD5 fa96965d538876003b1ef82e9b7d5aba
BLAKE2b-256 b364cab4a335dd6d15060504a183ece28cb45ebed2bb20d1e56de1bf89ba10fd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412141731932516-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412141731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c2df4b9452f193bb09013f1146f0de9e436181c6ef37c713805c0b74b0933ea9
MD5 534f23f6447132a7d307bc73fca9f99f
BLAKE2b-256 58f0f7f58c0c9982828852b085a3dbdb45aebf0824795f726ddb8c68351691a9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412141731932516-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412141731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ffa2ca7f80bc90483781a612e85d12e3bfeaca663c67bcae4b67d4bc991bad60
MD5 06a302b5d9aef30e64fc23382ad17cc5
BLAKE2b-256 8dd10f067bb892ec0c2d531fd113929ee3fad87598356ce2d3fbc82be7de62a0

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