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

Uploaded CPython 3.13 Windows x86-64

pyAgrum_nightly-1.17.1.dev202411071730930665-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411071730930665-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.1.dev202411071730930665-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.17.1.dev202411071730930665-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411071730930665-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.1.dev202411071730930665-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.17.1.dev202411071730930665-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411071730930665-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.1.dev202411071730930665-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.17.1.dev202411071730930665-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411071730930665-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.1.dev202411071730930665-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411071730930665-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 a087bc7dc1afdb07a2cc9e574e98675992ecfc614612c9c8ccd29338b6d586e3
MD5 2e8122cf6996a4d11a8258aaf8b95f8d
BLAKE2b-256 be253ee12f523763af33f483ef88d523d286acb917984c8c40446b0717fb4bba

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411071730930665-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411071730930665-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5ef1a43a8e1eadbd4583ee8ae1531aaad4a87718b5e718c72eccdaa804c0b0de
MD5 a08110d94021048fd3ed0defbbd8be4a
BLAKE2b-256 715afcc19d75310aaf08a2cc7a8aed8ad74f03c0899ef97ca612f3adee281968

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411071730930665-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411071730930665-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8641467076411b01b55a361219c269225648e0c6161f22a1f5457e834d2aa76d
MD5 21ed5a9397b9eaabc1fb0a1d4f62aff9
BLAKE2b-256 cc7b5ea27ed04b70d7d43e71f8fa6b61b2550e8e53db1230ec5c8f3b2fa30065

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411071730930665-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411071730930665-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 df41fdfb8ae7ecec7d282b754a12e4b505f7ed40e3846e3049b6d42f92989a2e
MD5 63a7d0e2d53c7e4cc063f73d49221751
BLAKE2b-256 cafcdb86090a841c368a00ebe65ff79d62763cee3725f987193adf0688ab3f9c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411071730930665-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411071730930665-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 698176cd1c6f422987ede0720e8d99b5587f7926531c2183419c354df76ee7fd
MD5 4559db367acd940f8c21e55bee3a9c56
BLAKE2b-256 95151b208a6f7aff03ed1513ddb9e31dd7d6501f01ce64b74ce6229e6c883208

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411071730930665-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411071730930665-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 089abc2e4d1f5a09d54bb51d6f4088bdab28858ee3ce613cad3f88db8306f241
MD5 cb7e9cacab962de9ae6d90158d970d89
BLAKE2b-256 ed6933aec1dacb1f881e1ffc78d389e024abbaaecf146034dd48d9d03440940e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411071730930665-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411071730930665-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2db0639546672aeb265eaef0a8704b6829722cfa144ff688e6a0d6dc7138105c
MD5 e49e903e792861bc93fc40afeb22e815
BLAKE2b-256 d2191c23f25637e8f5745b8b4706824eb6becd4fb1fd495c0a638d7fb3cb3159

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411071730930665-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411071730930665-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 adc970c12bb515966e494cdb7f1dc07a2e757ff15a2fe57705739e1bf49a3f71
MD5 b1be7b6ce1a768a71e7c127966e9eeb9
BLAKE2b-256 97d22765063d191966923e4284cd630b040e21e81f66c6cef5dbed6d38132b65

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411071730930665-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411071730930665-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 99ec73f99f2dbaa9e1b4feefb07272db5b7d9df680ab99f746644992c260606d
MD5 08ab73adc22db8c7481f11d2a2a5e341
BLAKE2b-256 4401e784b1ce473c8e9513e8dfa68ca9b2c504637402e8fd6ebf902b10f236cf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411071730930665-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411071730930665-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ff9a84c964ac898eae15d1c420f76b64f8eb7ec1d257c528ddfc98094fee22b2
MD5 484400707dc14419339f674128419d91
BLAKE2b-256 804291bec7a3b1ca807594cab4ab1acf038148228505cc6fe106c6f2a7fd717c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411071730930665-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411071730930665-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5cb1063a4536adfcbb77675252b1305269bde1a5363c504f48f0317a8aaaeb48
MD5 ed9fc385c3554be5e69ca2b59134f231
BLAKE2b-256 88527ca59f0b44af0e15e4031d0cdf91702e52685763fe7245043b0714521e80

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411071730930665-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411071730930665-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fb598da315338539b5605e033995bf25502c7d8b7b8d3c24283e1ddea7e70538
MD5 71c858fe7f08aead35f1209f93d91e3a
BLAKE2b-256 cf506e2fc93fa0ab2546feda4b44d817002b03c92a7365b93797bba18adad3d8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411071730930665-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411071730930665-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a59bc97a2c3f084ec041e330b3fcd60ebb09f6675f928ffb58d82b13d3456019
MD5 0c4ea337a47a0c4af03c7507d5effc46
BLAKE2b-256 629a1e3829db6a568cc0049afb3b1c959e6eec8e70853d89414ef7adff9124d5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411071730930665-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411071730930665-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d416b0f92959a34787bfe50acea531c809b1ac234fecd84ab1668b557343b9c4
MD5 640b3b57396d4e82e2088377ee545a52
BLAKE2b-256 a4ecc82798d5bf6a5f512821ee2feda035db34f3f2478404345acf81f0a0f459

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411071730930665-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411071730930665-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2bab5f5be9f5c509d267992a12840c6a26529dc8df8fe193ceb73ab26e097b4e
MD5 7da562cd1a33f5278fca30718f073f40
BLAKE2b-256 04cc150ed8660a6c5fba6278935d6a0f7f390840bdc13df1101c186dbdf1fe90

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411071730930665-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411071730930665-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1497fbc856ac8de3d3223091b0113763c84c0d10a235a39e8a642df78053a564
MD5 d808abcb9c8a83a9fd981dda68b440e2
BLAKE2b-256 8fc2d9384968126ebff76a59b9322e9c5f58592c6bf72747fd034a93235af0bf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411071730930665-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411071730930665-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9dc8c70247825893ace8197c1f6251fc14f164e5872b925537428765c50e0f8b
MD5 9152578087d481adb8d9a6c0e30a9c7c
BLAKE2b-256 56be7e8b4badd10cb2b458ee281dfbf6d466fc8edce7b04fd9b5e6c8e1901206

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411071730930665-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411071730930665-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9d7b27482c305dc085e1604133441a6e8d3d829f80bafe1c61a13ce9e647f9a2
MD5 1f23c36ceda024592537577e925388b5
BLAKE2b-256 5f86ebe106274e2dd50f70087ebae6c7ed1f3651af7a9fab77356caccd7a904c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411071730930665-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411071730930665-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d68a2069c9f90c5fee4f36145962b6316c8315b3cb946660e1771436896d1ab6
MD5 44cb2d6f574c5e776c7f8d9a8979e6b6
BLAKE2b-256 dc5b9ee50fcd110a98becfdc4ea6f8ab7dde1c0f12e1344df637c54824c4ea49

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411071730930665-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411071730930665-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 766cb7ca61d2b8c5ba7632562117a142d9ddd939e166b8df96062af4f73bb376
MD5 effe873fa657f228d357670f27c14dcc
BLAKE2b-256 930b88553283282c977e1cf21cb13d33331674eddfb55df03ee83148a1679eae

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