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.14.1.9.dev202406271719384100-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp39-cp39-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 bcdfe0229e4213f0ba73c5bdbd58db1e365d2c928b7c46387fa4d419636d4584
MD5 5bed79aadbc3b38faf4a9f8ec575227e
BLAKE2b-256 7959f2333a7315ff4b3798dfbbd00fc71265f70ddeb4179731c0e4ab582df655

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ad30e5d99dfb8f99848e03dc1191259226e5b9302baf15c3642851ad56030f55
MD5 41e4d8534defc88781f0de63b03e4225
BLAKE2b-256 a68e6f4548c378dbf44b712a2d5f195196da6ba17d0c93be00c31b0edfdbcabe

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9d99a635294ba858b82b22de1e6612fbf026455b7b9743286ec622e6357eb41a
MD5 02a425da6d576c34075ffd8a4777802e
BLAKE2b-256 eb4d4ac03ce4e92135b2152647e85e669361570213290eacae026d73dda39a48

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bf57978157f45f796963d9706c21025a69dab2d9725d55a9377e09967d4c8ada
MD5 0be30d2b37fdb7ed780f9774ca9d3a45
BLAKE2b-256 38e75807615727d9becbc12ecb8f9fccb27f121d4036509f83bceae945fb9576

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 33ba16214d64247801275455347e927675092bf18a6253a7549e23bb1513fe69
MD5 c3276a7a09517814ed9eaf31c616fa85
BLAKE2b-256 c620bd12d269f38088ec85b91047559cc87456e1fd56aa6ba64d6185dc2e4399

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 482042df044e567a426642a7b8d950351157e34d94a3e4a133873039eb8caa5c
MD5 e0ef23e50c57730e2967899c5dc64395
BLAKE2b-256 2292b5c20f4e0a10e0113ba75ce897578aa02847350053fedcf7d22765413b2e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5aeb4209b964a4f4593e49781eb1d41522ce2362e31a54aee64c070c23948d91
MD5 efbb9af312719631d10a34af01121b4b
BLAKE2b-256 71c414ba0763d64ac1b8b56b30694af1b6a03631b25df1d19eddef5ad34457df

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 befa6ffa8cd0e50a76014c2c827a7c7b2d901ba019836a01ab3b5131f4d90d83
MD5 1d88be17dfdee9c40425f7d2699b80de
BLAKE2b-256 30a87d84f6a6e1899767ced56ced46ce559e31aa7cff624ab1296e0cb12b4ec4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3b0a1068608b2f52c3503784af5137699d27bb260238f4ba465322dbdf790711
MD5 9488926ad358d7af89f8eceaba8dc2fb
BLAKE2b-256 6299f8f61490e7bda86caf813830e24ea6dc7b057c66f125cfa75039d7484902

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 359562b02e8fa1b062dc66dfa600734d648628c0e2294a79941e96065443d180
MD5 e77e35cb04a96730f99c7094c17b599b
BLAKE2b-256 aec5e505a08010c5133424a6667d5d671696c607a7013e4e96272083e98dc699

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e59f932480bae0ea6f7bbf595bb120c02994f9c8f6273e7ab6b6df9e775d3e96
MD5 66520c3d51bc87844a1eed1892ac44a4
BLAKE2b-256 c856da8b36c2882f6a8e92a7df711f88a57cb959eb3a81d49dcaab977b0562e7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6c3bf76b6a9193e62546d249241056f427ec1db817a57f823c08d1456f27ce9a
MD5 49710dfaf6b5d886e98b6318987bb1f6
BLAKE2b-256 68b31fa6d6814a8e95aac8edfa03fbe52102bb3572d6e04d72c12deddfec1f8a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8eb5fd6dc17737fdfe31758eca50db025d8b8d481d0d2b757dbe4c63b74170af
MD5 d706a01f80a601519649a473ebef4c6e
BLAKE2b-256 77d577575142e754c0d5b3934e90974d1e4256db3bd9cde96e6a4b61e9cc9b7a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3532ff3312c8143d513fa1acf14a929939cd04efc00e7105ec26f5e69d632634
MD5 21c70697bd53e08e67d2181f1676aa12
BLAKE2b-256 40471e8c7279c08ace2bd3f9ae524c1aaec6e1e36a53a1010129ecea6c2d7c83

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6a1dae52c983a962d6b245e6a6f3fd3c7f36312cfce13e8e86e68c63bbd6dd9e
MD5 c07a4b54e24edd9592e4446c0a38db1c
BLAKE2b-256 db9477084cd47b0d146e4ecce8ca61b8907bf7c4e8e89bb0cdce3bf23c961813

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 bc2ab9733f26ddbbaa0d31a6d32651a938bea0181ff0c01f8f888e8273bea639
MD5 0466d4218dc1e0256c3e292fc92380cb
BLAKE2b-256 106da45eaa9c83e7c83633c76cac6a5dbe7220c7360027b22faffe8e126ad98e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 aa167bc1ab7722bf70392de4d0f3217560bc26dcb5f30a2721c41ab15ee9c58a
MD5 b63b0cc2a6b985942898298b28b22948
BLAKE2b-256 b90790325d20427a2328ef5cd6517713e49e43b42391eb7080eddb387eacc4dd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5b80022368dd95019452746b0671c06e29b405b296a6f6bdfc9149254568b88e
MD5 7a1a7c88d21847ea7f388e8e7ec98fc5
BLAKE2b-256 ddcc3002aba668302c9b6a5c043f5ba8e56c4fae74d836ceba51d76f400f69e7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f607ed325c905152c9b235acebf3b3614853a7c746c6868f6956c5d419e8772d
MD5 54e6e8039c2d234b93d41758b6e20859
BLAKE2b-256 4f72898b6039a682e3d1349bc38d866f0e877f64b5942ade44250d48f0868781

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406271719384100-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d85935df525fc54f3a223b635ba4c19c809697754400d12264e098009364c65d
MD5 999554b3b296fcbcdb066e4ae1164003
BLAKE2b-256 19383cb88b8a51d78af3800ebb90785906e9493f87c001e9e3729c3cc3b38a97

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