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

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp39-cp39-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409131723794729-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.15.1.9.dev202409131723794729-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d70cd1d6f6ccc1709596633bd585147a8fa7a4aab4c654584d22695b4f1e47d1
MD5 2aa6375fc0a836ab2d11086e59bb9f91
BLAKE2b-256 ef039a87cacfef94f2b00afd0ecb36d4aa7bfa2f616da61398c97651caaae51c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2c915b523fe830cf1e9278ab2c561ad6fe9cd7fac7de171ea06ce0f8083e5a9c
MD5 5e12c71ae0924c2833223889d5294e5b
BLAKE2b-256 e914aa736b5779b1d2b6a0c023c51beb91e46b94f32219244dda2a6cb1df0183

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2ad48f7bc943c276f3f4ed369cd2c8f32013df69856d1b10b57c565f880cc86e
MD5 611afb345d37507d63d7b3512bb21813
BLAKE2b-256 ec7b62bbf37c7c1d10d178f40f667c94018ddcf864da9225d75fb6a8f692ad7f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4e5756213733c664f4048f9eb19c2a5ba7242aa03362bfd42c114ba0eeeb108d
MD5 9c64f7b43b9c80f268b8fb4b88c35450
BLAKE2b-256 02aad0b0c8c4cef8d854f2b7847ae67244a143a5c458eee44bb2c1b9576c921a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 237d2641aa661dd4091cbfba1a3535e95a0c6afb86d65a069a8cf82960f099ea
MD5 cabd868eecdb2f9cb2e4704e6ff0677e
BLAKE2b-256 9c0c63da37fbb5d23a615a8491065f048dc3e842fdceea2baf047b6bbff2717f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f739548c30b181d65f45bcb78ec943e47a1f49960034b7775a4cf4e328639e07
MD5 50406a2b3937952c9e69217de3fbf16a
BLAKE2b-256 294c6e7d6f0b42478dfcf2a8db68f46726d3f3974057af324cf8f09d2058a617

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4b503f133a1669b0aa0ab9c851948e1a9109bfdc00b34de587d34d8152cdbb4b
MD5 a87b2f1e4d9411a699c1cee0e2ac44fa
BLAKE2b-256 d22a0a01662558a24cf9e4546e0d3fcf167bd3f5e36559f64c68a17d84e28020

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c366a6de6ef84f87171ca8c009a037e36d9daf57d271ded70901a99214011948
MD5 dbc77d984860419a1320cb0beccb3de9
BLAKE2b-256 d6e3bd772aa3dd79d5cdb329002364851bbf95b7f55dbf17cb5dd399b8561c26

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6c42cd55680d2ddfdb361ed4a4e210c98e420f328a625c345f3ad0fad3a13464
MD5 54180659b813a89dfab0467b0a3df4bb
BLAKE2b-256 035bcbd9702c497e9108abd6ec9eb5164381539a64282b90ecc46c62c193e8db

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 51d5d9dc4d93aa355f00fc35325a0ec8ca0bc0c8728d5539c113a7c9976abb68
MD5 206ea1b0931c35c958b07c11a29619b3
BLAKE2b-256 21f3471fcbd696be9e6dcdcf1c0f207abc0f6d4d8519edde8473a9e154fb203d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 9a84b003e97a6814ff416a0487afdb62fed65ae06dd672e1c15987194d1a234a
MD5 4147a7766ec6f4cbf6b4fda169a7a3ed
BLAKE2b-256 65df2a8be05635288ce22b02ec6ecfc6a3e96d40d8fd96cd748d4e2814741f85

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 adfae3d7fc65888e01fd4dbdd42c40e23cae443baeebd3a8ff1b999a7281cc48
MD5 2a2e214597834e5cc9a7b8734e7bde01
BLAKE2b-256 4f52956cdace37bce264a12911d7dcd36fe59d252227999596121f11956af18f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 be17dc9d8bd778a14baca379b3cdd987a76b55a001de0567dd6ae01ce862e38d
MD5 0efd10426c225be25a7aa97fcf8f3ef4
BLAKE2b-256 f317abf55ba489d132aa791a7ad22854d09488ad434f5eeb2df48b3fc8762bce

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5ffd7ba408b7bce296605ea2ad4ffc40fb21f5e39d6e2def717d225f55dc408d
MD5 2045ba08c585c14bc626dd37d7d9d2ed
BLAKE2b-256 b5f49b9cb39542aa7c4f7d2d10c2f834e19b3be6b314e0c5fd8fd950498cf3ac

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f7f4e9bca769d824c85446736705a6d00cb77db455e0d34245ea0f86ade287e0
MD5 a4e3b7c6bf8bd433f9706f2198c09fb9
BLAKE2b-256 587dabde3e77a0f60d657f0571bedc6f08d8ce028e2fd79a8d772314ec232723

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 2a51c1763af8fda29b5196b2cd9d734c95a249b2f50800a2db6b4d3051331184
MD5 2b6b9b710073019a0ce51364fd15d612
BLAKE2b-256 852681dc428f81eeb5985963f29959cb09078b084c739034f947eb4528647adf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9b62b50d3190a4e2589e970a044d701373905a8b0414691166290614f4d39003
MD5 9a950cc7dc0fbc5e97547057c9a964b8
BLAKE2b-256 0f7a5a7011aa2a30d30360cedc549294cce0b0de5a6d898fb5d72e77c7ac2c31

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 03a452a88a4ec9d4fb45f143e92c02374c004c52e7c2269976b9defbd91f99ce
MD5 01b07141f9b65698e54282281344f377
BLAKE2b-256 fafb75167bf865534c4e6ad006ce7dfaa020a608f9ffc032dd38edbb8d82a1bd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8fa6d89956d0e53ed51e1d90d11ce98fcc88b7cb72aad1b7fe8d1d2c5f1e7926
MD5 7191c727b29ddfc1b82e460a64e4af40
BLAKE2b-256 ead7ed7a3a7b0fbd92a0cafc425a8f36180dcf395124b6a71daf7275ac9f101b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409131723794729-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3af9f2e2916c83fa2aa948445eb652a0f8b75e8b1a89fd20101ff9456e8d3a77
MD5 1c022f77fbb845cbbf6ec043c607b1c6
BLAKE2b-256 34127c20bbc1f574c7d6c59482c75a7c2b00788e41d5786e2801fea6765678a4

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