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

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.2.dev202412101731932516-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412101731932516-cp313-cp313-macosx_10_13_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pyAgrum_nightly-1.17.2.dev202412101731932516-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.2.dev202412101731932516-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412101731932516-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.dev202412101731932516-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.2.dev202412101731932516-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412101731932516-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.dev202412101731932516-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.dev202412101731932516-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412101731932516-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412101731932516-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412101731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 cffcf2a1396a0bac3d21cff6cd523b0cbf96f92472a939e38dd4a805f28640a4
MD5 610adb9096273d43e9426e3f21573c20
BLAKE2b-256 d8ebcf8ad5731c93ce88d015e0c572f11a349161b868d1e6a7a7af13fe00863e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412101731932516-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412101731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 47a93b18335fb176c7f39c922abfa2f6597ad9ecc2c3abdf3f7991e32a99540b
MD5 7b4d14e538cba005900b2eaa29ab1138
BLAKE2b-256 5b347e1bf4e4317ea006686bf155505078cf74e7b6febef6de223da468b831f1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412101731932516-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412101731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a4e88aedb7a1b665e11ed42f95536f79afd97541a6b026be470d5d51f3351699
MD5 11561f35a1c4a3a80646709174831b46
BLAKE2b-256 ee4b9b05095052d6dea85b840bcbda786d556f90fbd2cc2a9526edcd34856ba4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412101731932516-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412101731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7c4700227ccb43cd6bf0f79fca0479b72538b1b6bce602232793e87fc75b09e7
MD5 03244a2d1a7310be9c8f6134216f6b47
BLAKE2b-256 fae86941b43918027b6411ac1ea4491ff51eb7fbe8d70a32c3558bc7130e2ab6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412101731932516-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412101731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 dc1a559aed05253ad1ff1e1121c5065682e4d7f8f22e45db3232b17c95b1f5c2
MD5 f13ad122720e99cda190aaa965527038
BLAKE2b-256 691d02a7df2647e27d89c6272e31c0ad56c5c348f62fb4bb7b2d30d1d4926acd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412101731932516-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412101731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 c0472d71e5264c245d52d46345cc283fc3091cacc0227eeea04db79f208eef93
MD5 696a425060528c0d0d3f49a9445bb6f3
BLAKE2b-256 352d02ff820108d38c9c642ac028e2b2647aed03e31860843999a48703533be4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412101731932516-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412101731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9e814981590f2062e4bd450f833fd903695010a6fa194227de951d67324e4fd1
MD5 548e5983efb3de44237202bac8865c4f
BLAKE2b-256 5f844752a2799a01577135aea7da51477e7f1e4145b11535d2cb50f6e66d1444

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412101731932516-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412101731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ab22f05c2d853121d153b3a2b11c86a4c44526d51b56910aa59c2d5654d7d38d
MD5 d6a90553d3e63383667133fa6d94b537
BLAKE2b-256 d4b898da23f97049e0de9111963f3cae29842594abc7677653acee2ae81e6544

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412101731932516-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412101731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c666f0b546729317264d77ad8a4d31eb61a0a15eddfa1f2403dc184a83b3dd7e
MD5 dc1620141f0ee169f51f03d23a28224b
BLAKE2b-256 04ee9c29ffcc6acf4d416afde05960dd70021566f5f3637c175bf6f14ee5b2ea

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412101731932516-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412101731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8213b68c5b2a8af73a16b983f7305eb735bf63f77e5e651dd2786082da7a7b8b
MD5 0447b869547ec562e76b1ebddfd045b9
BLAKE2b-256 4ada5e8c264593bb1e693be70ee3ba6e1550f32faf58f29c5058fecfba5970a4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412101731932516-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412101731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5d6ff5f40facb3a0b876c4c5f127e0a54469ea541df00f9359ede01ce3b793e5
MD5 4e9b8d15bef9533910b9591f1e502f96
BLAKE2b-256 aae3c69480a0a775c08343043da3c634c10f08ea23697c298023ba367010aff3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412101731932516-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412101731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3ae5c761ddfb0caa1843ac3ad364ac3af7b5528e6f320325baf40a62ad08e749
MD5 1f7179ee98499a5757c993a89e1c410e
BLAKE2b-256 6ca0b964c896c07d34c0ab7709d8a64a38089f40cb68f3907e14398c87f16dbd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412101731932516-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412101731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 63ab2976b32d082a1908f3de54cfdc6ca67257264ccd0ab80f742af493488f7f
MD5 b4327703cad44c4f6d2f054435b89f72
BLAKE2b-256 75472819fdbfa74455dc70ce990e3934c7b036dafb0c4499bc3400be298bf16e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412101731932516-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412101731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 415c5907948ec2fed25638850dd6d71b9bbdf7c6e3b1ef6db08568e28b71c83f
MD5 3822c7b43538eabf86181dcac9c3f2ee
BLAKE2b-256 892d89c277021752705507fbbe2da23a7338c1419d6ac9272035451a884057a2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412101731932516-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412101731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 642592dff5ee37f45375fefad82413bf3e283aa3eeb225bd0461f5ab4c2b6930
MD5 d287f3cc5aeed1d39e1ef6f8a1cd5a8e
BLAKE2b-256 1eae72eaaf6f43a41e4735089e8973bc74ee8972a468d9e58e2fcd60fabf9990

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412101731932516-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412101731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b86064e5bb34f4e7cd8ec45bbb81f3eada75092930dc7af4c08a42b0c2fdfc4d
MD5 8c84184295a8f322a12a613f17b8b765
BLAKE2b-256 57428ff369264fe3b76f0ea4bcea5b4ddd12442ccea68de37323468c8a25dd81

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412101731932516-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412101731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6fe272e4d7d540404550e5a3341575ed4ffd8b39ded76e5276952f8cc45df1db
MD5 ac07fb53ecd127c400421fb708e62a1b
BLAKE2b-256 babe615a04ab3d5b3882fba927cdd78c75f1575a5db6cb61da2dced93d9565f1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412101731932516-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412101731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 196e7c4068ea0c653c6039fc25d996973346d2b35658973760ca80d57ada2a01
MD5 2ee0b23b90e3b94819d2410b4f35ce9b
BLAKE2b-256 51358063e3a33562210e18362e499b5694cd360461710de424c3ff0c963da360

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412101731932516-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412101731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d5dab2cda75f90d279a37b7a56b7202324dcaa2c3ddbbfbb15d6f701e4673f6d
MD5 e2a9022a3e68b8ff0f03f483314b6286
BLAKE2b-256 37a63c5f35439b0b78702c70dee1b5f1ae037c804a96d62d6bbbdf4956e74542

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412101731932516-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412101731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6b8ca5b8bc0485af9cf036d484d19e67aa901f4a7814e82beca93649c0ecf40c
MD5 113e87b4204f660ee515da170a959ce7
BLAKE2b-256 9447895bd3b5ebd720a85511eef2c008d4e40cbbe3d71f708c13747f6f5f10ba

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