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,2023 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.13.0.dev202403271711457924-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.13.0.dev202403271711457924-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.0.dev202403271711457924-cp312-cp312-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pyAgrum_nightly-1.13.0.dev202403271711457924-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.13.0.dev202403271711457924-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.0.dev202403271711457924-cp311-cp311-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pyAgrum_nightly-1.13.0.dev202403271711457924-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.13.0.dev202403271711457924-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.0.dev202403271711457924-cp310-cp310-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pyAgrum_nightly-1.13.0.dev202403271711457924-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.13.0.dev202403271711457924-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.0.dev202403271711457924-cp39-cp39-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pyAgrum_nightly-1.13.0.dev202403271711457924-cp38-cp38-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.13.0.dev202403271711457924-cp38-cp38-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.0.dev202403271711457924-cp38-cp38-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403271711457924-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403271711457924-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 dc9b9970623ba133e9b853a0c9eb67dcd7a661618562cc3b670b6ed4a2a57473
MD5 621e748aa974ac6ba318db3e645aec17
BLAKE2b-256 743499188f6d2c704f17bdee703885a418cb373a165f29bba726760090a3e863

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403271711457924-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403271711457924-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6a678e836014ed55088f7912a311689b6eaa652752fe48abe44404a63034cd9f
MD5 3ca6ddbf2363fc25985508d6bf7e4dc0
BLAKE2b-256 2441c530c2b1b0bffe59ac1ba0c95e044ae713b7d75447407fd3f8220b53f6f8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403271711457924-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403271711457924-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4b101b0dca1053c9d1c3589a996f82db05c35e07a772d50613513525e87690ff
MD5 03297abb476821cc24111dcaea7510a4
BLAKE2b-256 380aa50c8d96af1c9a06326e6100a900f83d7ba4ec0942fd11a631b9dc397087

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403271711457924-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403271711457924-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f901183b9a1eebc00dbf68c29579a6ff8dd9b26d4142fab0aacd6196d23c52bc
MD5 bb8212d199c5d29f2599709c3388d237
BLAKE2b-256 4a4eab9fbd32cd28a773b541d7988866062d24293605d9046edb5e55836a1321

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403271711457924-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403271711457924-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4c5d274b47d278cab88873dc10777448795dd5d4e9084475abc3a714e8374899
MD5 c35db745a06541b9692f2ffd696c6ec1
BLAKE2b-256 ca3d092f07ec8a89faecfffa0587daa457b5ba5a8a8fd8aadf18c09e802030a7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403271711457924-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403271711457924-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 0a7f6c2b8360b97df5d7d8a2bfd21387ecac55c0c422bf170ab00d00b41ad4e4
MD5 9b86364de3eb390c4d153bb805dbec9d
BLAKE2b-256 9b262284087454998be26c3d284c07d387ffd2e593a0220836938a23f5a0a192

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403271711457924-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403271711457924-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c79a788776ffa056fe23c5c1a07a528ec9b0871650f665b1fecb75103232f6d8
MD5 fbaca60cd09cbd7dbec12414f651edec
BLAKE2b-256 85ea56776928d15f7eb46cf0a4100b56d6a37cca2229de35e563db4d529deccc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403271711457924-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403271711457924-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b8b4ba3406dfc0a6ba0ab9e5c50d7200096b8d768def3ce433344efbba1eaae4
MD5 1b8190cc34cd2ec1f4b3d16fa9680fe5
BLAKE2b-256 5ad7e0753e9bc06b2dd37a26686c1ea08a374262279d0318ff69e5d2038a9e86

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403271711457924-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403271711457924-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d383da0fb683e91472a7055062ad79fbff764a7761f101f50ab2afa6c3626682
MD5 918a7d1b2ded6f478ada774cdbbf5b44
BLAKE2b-256 cb983240dad6c6ed12b852cb38b03ac1791545308f65930b715f47543a38d3db

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403271711457924-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403271711457924-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e087c3b1251a50c38188353310f036c6e47127adfec84c204802f10c49483d10
MD5 f6e6763b4af8bc8e6c5477b40269e31c
BLAKE2b-256 3c605687f489009bf4a6055ea5a17ac55d3ceb44aed8b9a243f35d896ed795c0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403271711457924-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403271711457924-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 268ef4c2f69009c9c1a8796ae2cec284eba36951b0899ba8498130cbdd2af4ed
MD5 8be23126b2f1d978672019ddc8f14307
BLAKE2b-256 72f8a1193c4efcaad41dd92744d24a6c3887c6f816fc08377fdbba6f930639a2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403271711457924-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403271711457924-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1c1cf0169939040d9de67036a8b666076a082db99b2c9768e6224e6d38f89e46
MD5 c735a8f58779a3ab8c420b2dc307fd5c
BLAKE2b-256 b99e9c8149e01a1ea62e93cac13a1fb3bd6bd3c9ba7fabc34cff962ab3b2dae7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403271711457924-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403271711457924-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 95274bbd8c1fabe48492b1194b887e1330be671f71dc871d295feb8e28fa7627
MD5 80f7a96347f8a834e17f9c55f9e3fabb
BLAKE2b-256 02390e40f03518471d24323612bb237a5e630978b27470687060891646dfd91d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403271711457924-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403271711457924-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 80d79f03f37cdda0e07f3acb70d4df5684da3853eff244bf2d194c20584955ae
MD5 ec9f3706c9faccb4be3e5e522ca26241
BLAKE2b-256 6ac79b22baf1382f8239f43ccb383f5721e3a04eca4e284508cc343f7b051443

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403271711457924-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403271711457924-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1ccdbf53a3ddde396f9754627830b15618ca9a91889c6f21af25a4dbb3dfbeb3
MD5 7a9df787b35ed064bd376b5966afe2f5
BLAKE2b-256 77269210ee07294b94cf24f8814ffa15f349aac174f56ffc1698faf26622aa39

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403271711457924-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403271711457924-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 de6a7d1a4d6cca0c5f42235b052fdcca170b49b60580857d567e85af8d7bccf6
MD5 5c205e590d9944388e78832b1fc0ee87
BLAKE2b-256 e3c930030664ba02533ca4a9efcaca83774db3cd77b07c3a991651e5e88bc4ae

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403271711457924-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403271711457924-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 119c4ea0fb0210037d2f52cf0142d8dd6768017c41274dfb4b9ba7b1f2280d48
MD5 6f12b804b4fa720e03f2f3a7a2cb3b38
BLAKE2b-256 96704d7b5dfae3376b7bbfcff20a1e51e978e66ca260dc00b0c4b90759fee3c9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403271711457924-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403271711457924-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 557f4e1a6df2f23f789240f67554a3cc07781f51d199078f1844b39ef24c31e8
MD5 0fa7b1bf49a41c5422be04f1549d1828
BLAKE2b-256 327b18b05c0374173c7312bc053e821f770d504b113754394025c41cb7d4d072

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403271711457924-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403271711457924-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f996e570ffeec1a23b0f756d9eb2c63ebcaf44a2ad34bda135f9a156a5ddd907
MD5 8c1bf6ca7db12253d0d08a0cc1fed776
BLAKE2b-256 c39f22472326f0dfcbc4e2a305481365b5491f34e179c660964049863b98b0c8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403271711457924-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403271711457924-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9024095b80dfc13aafde622bfc10b3498f833be7d29dedfa74ff49063da371da
MD5 2938312a10492e6d7c1ab0ca5a6eaf69
BLAKE2b-256 2e101ab2c05abcff34252f429a4691128eed76f593c2507fda7721ee3e5b0e05

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403271711457924-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403271711457924-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 53ed4fe79d803c0b425e0cb73375ab22dd5db36ee9c04960b99187b939011ce5
MD5 751486a7e142aa55b0d93589dabf1b5f
BLAKE2b-256 1ea516fe26e463d10a147a1154c6e3790e023f01a6be1a1e7fd942f5cff23a6a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403271711457924-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403271711457924-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d20a46f9b3829d35108f515b46d81b19ba1d4e63815d1788210a1abc4a785c9d
MD5 e8a9d84a1b774edc6471eeb218872e6f
BLAKE2b-256 cd9ebb997998ff0f3937430043c1d6c4453a09fbf9a55bd86c779d03aba3f136

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403271711457924-cp38-cp38-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403271711457924-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6e004600150ebd9993e2a7e66dc87398e4fdda7fc8e8e4cf6ed95bc6c3a6b0ab
MD5 b4a69af495322f3300d947e499306c18
BLAKE2b-256 55ab80e061f425a838b74096d6cbeb92be7b54cfc50f85f4fbb0419b83999a7c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403271711457924-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403271711457924-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9459b6e3022c14e7be61d0ff4a7e5d5819adc66893b9d2ace9891807ebb5b4e6
MD5 63bcc4e465e445ae1764a948ff881a84
BLAKE2b-256 57a2dcd4766bfa6e18d8ab07018df136735b7e3ce1c999eb610c3e58632277ee

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.dev202403271711457924-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.dev202403271711457924-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b43d6b235f32990dac1f01c4d5185ff14a236bdf2b9910a5cb765ef637df490c
MD5 28586d3fa23d8b7f69d7acb7523dfb3e
BLAKE2b-256 f46ad65eab37b6d43d2bec42a42ed15168e62a9cc597f3eba2fc8a4cfd3da554

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