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

Uploaded CPython 3.13 Windows x86-64

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

Uploaded CPython 3.12 Windows x86-64

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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.10 Windows x86-64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411131730930665-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 3bc3315d258a5bc8cac3091497187c33a4c72cdd41669511f7c4a908ffd9a625
MD5 b55ab4492ee0bf15925744e9f68c9782
BLAKE2b-256 668a5fe3d8e075f1e48044394714135d534e5fa1b39b53eca0909bfb1691212c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411131730930665-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f8735b33f10186e489547741d50747a6b6e2df78f29bf95bc1545af4b884cec7
MD5 2090ac8eac4c784682298f2d41bfb77f
BLAKE2b-256 7c8d536e412a2e03eb7c2af5a4c543522c356298888a9b417388ada0a47c2503

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411131730930665-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f52d8b907751f7004d8d06cfa88a8dc575780c3f966e92885c006853d1c9b83e
MD5 f3e39de7b5f95ccc430e29644fa1a493
BLAKE2b-256 700c28b1af6bd5cdd7f0701bd00b8894ff10d0cfd1d6bacc5a2b43e37f76e1ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411131730930665-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fe381537b465a751fea0773b1016dfa4eaf0e0fc673ec3f77e8643ac7d59059a
MD5 a92dd285198ad0f34826c5e635b29513
BLAKE2b-256 155fe8cfaee84ca026c578700c46bf532bad84b381ceb2ad77c0d9d3e6025e1d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411131730930665-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 bfefc57d949b3f9ac8a230fcee5bf9dce371eacdab3c931538539eb8997bb544
MD5 8709f87979f5b1792a19d4a885049a80
BLAKE2b-256 f67108c0da1b71c6600e23c4752a268ae91b096778c3043ea78470f4ec42fd70

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411131730930665-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 613d7d9dca26d3bc7d0abc03ff268e947803eee8d2b0e8414815ac5cbacd2dd5
MD5 e1dcfca878f303e332e9a8c7807d0ade
BLAKE2b-256 85fd6bde58444bd01f556edeacc04cade4e1e1c12f265c92c3ed87cd59a50616

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411131730930665-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dd9877b95761f5986d86e66a9b7477d4af22634bbd2b98d98ec04cc52988c228
MD5 bc18b96b6c2848b7b76526b2660a20c0
BLAKE2b-256 99af78fcd8fd71e4cbed64cd705536b34607ba7d742ec306de9938c53d5cad24

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411131730930665-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ede990228962143f2a89aa9a26a53f635a896dba5d27f4593c016b1027fc16b3
MD5 d7aca6dd0e8ce533302e4fcfb3474e0a
BLAKE2b-256 f9a48f3d46c7331a38c10e4c766b6962e303c554b3d7b337d5a84a86df32e358

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411131730930665-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3f63a2bbf90655016b3e4a9a9dcc75a0141bbfc5b32f20b3c7165b8ffd2cae57
MD5 99ccc1f3721c0042052221cbe45043a4
BLAKE2b-256 87dd2423a7cdd04e7a775efdf4bed80fde5969f29b976084d80b1ca17efafe36

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411131730930665-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 fb417df98d4bb47c54b00621ba1f33978ccfae6e7b75bea3c1aa8251546c6bbb
MD5 224edf76368145dc5a4ad40e1949b085
BLAKE2b-256 4d24a5e64bc30eda8fb80879b7742ffa49ef82ec87540a92e469fff21348c8c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411131730930665-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f406d13a600236e36b1abd9386fb6dc75e5f9b4e02795802aba6592c2d489168
MD5 8d6309cfd63118ca4b0069386fdcda64
BLAKE2b-256 66b9a98849c89de37bdd0b99363e5639372e917c5e74a4cf391b2979231ed913

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411131730930665-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e3cefb40185372e05d5d1f42eda79bb04c2be226df1f6bbb2a807ffcdcf89562
MD5 e86f6c8aa238381d87fbec208bbd3279
BLAKE2b-256 79c72b4074d4d17c3e939cbe955ea334561d8986e1df9ea346b9d9ec24202a95

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411131730930665-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 76fabc0484b829406e518d0fc79c3a22dd38f02631ebd04b4803f00066778a2c
MD5 fb0d7c03ca53f77751c3816e801d7193
BLAKE2b-256 dbebea779c6afb2c54797e7fb31dc38de23afa4e62194d22f331f2484111b9d3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411131730930665-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e8693dc3ebc3896f1adfbde7d19ef1507727a5fd6bf07a5cd58a4593be8d6d26
MD5 c56acdb8efc5c629745441d9fff37089
BLAKE2b-256 35596c6ea01593d721e37791727cbf9944aac9e9fb1bbdaee8ff176d7c1288ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411131730930665-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 20681a083157967f8ec02f228bb3021185f6d80c0ab1dbbdb1247a717f7feedf
MD5 b2e9a543b1b4825bdd716d76021f8caf
BLAKE2b-256 5075d97da2cf52460d00997de9987da10e18b24811160f67fce512f4de1086a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411131730930665-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 72472fcfabfb26753a0a12f66113c94b78b519c811b9f303692a690a9b8f2ad7
MD5 966496aec81bb2eb2b58bc6946945d89
BLAKE2b-256 51a3664a9fa4ab304679507b4e499e3f5dde164e0d0ab15876946715455f870c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411131730930665-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 464bbaf57cef33809491dc8f8f8c617ac6d31659f44331fa07fbd512e2039de7
MD5 a54ed62dc2b7ba895bdab20b923b7f17
BLAKE2b-256 e9626c647b8f8ea345f4718e956d13201c113831611c2b8337d7f2227caf2e36

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411131730930665-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 141554125ce6ab5f61b213aec55bc9df6b94205004f6f8cc5228cbcb461579d3
MD5 27aa819dc617c6be3a9dcc974a74123b
BLAKE2b-256 99ea19797a63018265f63f563548f3b3f224608b84614c182498a10a8c41dd27

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411131730930665-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e8f04e15c988a160d2901bb1fe7452809234dec912168ea5933632952bd6857c
MD5 72e0f8c8ed32067a8a9a625aba4b7cc3
BLAKE2b-256 5d5ba56801e47e2c9daa261b15c7294eb9b9d80102cd0ff9cafeb5b7a388f3e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411131730930665-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5e456b7d140d2e29b1f1af997a1bc1bf825b6888ef42a2f69d34743c896cbf8f
MD5 c34c2da159d8acafbc8f11c41cafb317
BLAKE2b-256 298ac93cf058a1773d84eee4db39f1b1e0e35e8062a0c2deef3fee58ceb50dcb

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