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

Uploaded CPython 3.13 Windows x86-64

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

Uploaded CPython 3.12 Windows x86-64

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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.10 Windows x86-64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411141730930665-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 3565bb8cb4035c4e7713a00d31fbe1770f59880fb7dba5614dbd0525c0f6606b
MD5 9afc55360ee5f34f1b29de0a6ddcfec9
BLAKE2b-256 fd64e0da0350492927ceece93371db21e5250fe256e0afe3c83f4da24511f7f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411141730930665-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d41d41fe10c638a162f48c6edfc541d8e99aebb82a209927782eeb0ea9299cd1
MD5 f3502eb6bfed8f829af5765e5b1a38b2
BLAKE2b-256 693b7356742069c0fedd23b99ef67a33d04e465710dcb26a226a3ae7da88b093

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411141730930665-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c43aa32d934828f9151e84b6294aed3c8ffae29db40d9a7b5dcc062aa6f0f33b
MD5 bce12d641ecbf9ba36f1a6eac7930072
BLAKE2b-256 5b15c9d129e3c4d5b430fedac629e8ee51bc30e487bad09dfa837722b14e0d56

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411141730930665-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ecf475d2d8a5f679cecb6297655b877d554cbff6aa9c7c5a4d358f04f07ba0d0
MD5 17c8766c999876f8d921636f26100036
BLAKE2b-256 5a706da7d80b1432c267b5fc96fe9e236dcaaf2c4894b8f2d382753317b85c5b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411141730930665-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 6b9b95e1b32c9d79ad39ffd6f19094c0d4c89c6f6e5f7448b5ef7031fb9ce574
MD5 62cb289c69082e520366980321128e78
BLAKE2b-256 70af05f53fbac6dcdc165797fcb04a1e5b60b071dc461645aa8285f204f9dba3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411141730930665-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 34523203c37c74c8442752d07952381f04aa157e897cc32dc75815d74f88d546
MD5 69a5290a3dea4c562beed55efc6c1718
BLAKE2b-256 21b2e7806155fa8a57786885a24b009ffdb8ad54a600e4a9dd14dcf0950df751

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411141730930665-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5677079b775add2ec5b6e6efe648a573200b2845a90d9dda4e910a0eee8a78a0
MD5 f9a0b53e80da73711ee95942aabdd040
BLAKE2b-256 bc0ae14b35b79c0b2b2b4a73d07827d93c731aede2faddfaf68de5a9a7008109

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411141730930665-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a17c15d4df22a2cb329b6d256091a92c7cfa5e39b629251e65265db09f99c028
MD5 80c34bd757d22cfa465c4f1d7db41d76
BLAKE2b-256 996f98b33cf23eb34d7ef0b7be4f607fa2b9030b249cc1d811898ebeed742c94

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411141730930665-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8fa68ae3727e4b452e3ddf269caf6389b882a60aaf98b4c62fef9cd578f2b582
MD5 95e90f4017335d2b32f998c35446d90b
BLAKE2b-256 471de646d75829543e0057a3b9648f0ced5ba4b471ec0c400b99c51ac255dca6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411141730930665-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f6af3e14c42c0edc77640d90542855ae4836266d155c1699f7ccdb857b260289
MD5 32bc20fafb1cce5a314444d33197956e
BLAKE2b-256 204722ed7d64f46ba86c51106f0ae62e815744dd5f975f932320c53b33069a71

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411141730930665-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f6e8d8ebcd718680e4cee7e62e53d7a52549b9b7da52da07e596f417c0f4fb8c
MD5 35e352791ba5d555d10191841a64c2ae
BLAKE2b-256 7aeca193111cb2f35172af74e487bcd71207e32ab21d848b3b3d6ceed6c18359

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411141730930665-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b0cdcb2ae5f081ea2e6949043e5bea3489e5ee7410f0740783c8f4bd2cdc6d08
MD5 bdb8a90a4901c61372efdb23799dd74b
BLAKE2b-256 8ec3c1b674bb97393447334428a7d538d4f96fbfe18fdaa41b050df34c4c5713

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411141730930665-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d2b5b2b47b3bbdba9b1a7e5f2667ffabdb54a7d30387ff90cf8126a0658cf450
MD5 cb764ec9f6b78e0e5c4b08b1b8c29e01
BLAKE2b-256 3b711437eadc1def2849d9e53acf4be742db83df0491c24eb446bb90afad908e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411141730930665-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bf1af3c1be95ee8238258c2de95fb27686231befd574bf1d1579947f4f92d336
MD5 a1640946215eacd3b4d8af90e0f0f196
BLAKE2b-256 f53a4890ab174b9cb0af06d628966c1b05de805be8f1ee14da41f2b016770693

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411141730930665-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5099125f470530241d710e7a1d6ba95af6c3f2f3586de6d3a6aa412ddd620772
MD5 77ca80242b06910136b17b8215eadc1b
BLAKE2b-256 51df6bdfaf71eff2a37fb2c4bce81a16bc6714d6d565117b347e3c03aff71b59

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411141730930665-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 523d8b0489920d8722a3bd36c6a6a0d63e7406872dfaf3fa00b3dd0ae6b0cf86
MD5 5388e707007072831bba7c102e8ba4ba
BLAKE2b-256 cabd7ae618513e7cbc31e7993acd309cb89c44535cf1b03d7ade94dfc5f5fa2f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411141730930665-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 271d90b4593a5cff993fbc0f1a506232630000373aa7765770b29b2f533e3a33
MD5 a92543f241485b0abe669ef6c1bb9f72
BLAKE2b-256 d35fdaae0115b10cf670d5f7d28d1243380d8faa193c21f4362ca65589c6ba90

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411141730930665-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2e871540d4db6a3a814c9d5bae4db97426fc09a7a476f647f22d270b54600291
MD5 f09271273ef5d74f3d475275d16d864f
BLAKE2b-256 4704a64d6587f6b4cb68a6eb84113f5b9e7f4bdb7d02c93868e43809a0128a42

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411141730930665-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0d1aa98c64964c3313bb9bfaff0dd126a2777773b0c71986591096559e08799f
MD5 ad551d65e01af2e8045e43bd991d5f70
BLAKE2b-256 6cb48426d31d11d4d5dacf73a030d5dbdce9d0198cd9a26546162af8500ef63d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411141730930665-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e458507082776925d9370f36f099847a771a8c2d0d90705311eccbb975fac216
MD5 7d433f0c68d2dde1576c6ee5cd11b54e
BLAKE2b-256 4ad0b3fa45a6f1032a045bcf4255938f75f4421d82c01f3b6c40f4cf05e63566

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