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

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202407231721169663-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.15.0.9.dev202407231721169663-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202407231721169663-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.15.0.9.dev202407231721169663-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp39-cp39-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp39-cp39-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 95bc485164c38a90e9d3b0ecc21c21d17f14785ef44e409c20dfda84d7f58bca
MD5 66048782edba2fe9f864f8017fa6ee4f
BLAKE2b-256 d804fcea32bddac8417ba305bc1fc103917cf207c33aa2e76e509931b23aa2f2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 837771facd6a8ff5ce4cb37ac8618be50c497df9dee04d41f5c576d0d3e5e4be
MD5 a31ddb475349ed1ff68534d8d3309fe4
BLAKE2b-256 ba33b213e1f62e49bdea60d78146ac7347d8542e3c2febe4ab009e43ea2f030d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 73d49bcdac4b41b535f040895600fcabd5a6131dbdc5145bb632e7aefb6c359e
MD5 077412fa8d57d7b0dad7aabcdbda59bf
BLAKE2b-256 5a79b7d3749007b6fbcb6820d95b8d2b920d35fc3f21e11019bfe6af33cff065

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9d1059a8a254d6e7c6df426a0033e142c7c8e6d50a8f4061a63cd511d6b4605c
MD5 af343b981f21b1fad68065a2c5265fef
BLAKE2b-256 a659f86f0101a62b7a5ff024881ae1fe95bebd2ed4e359b371afde3b66ce4314

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8f3b04e4b6d975498ffc9ea7cab283369d6e16dd5c43d1ec0ba279b59bb227fb
MD5 776b994d3196019000e06bab6f9a1725
BLAKE2b-256 05223a4342e6f82f16fe69bb589c318a12af5325b6ecb18a2b9f7ec1f0983558

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5147049138ee61e98176fd35b961d69f8e4ed62e725246678b974352d01adb74
MD5 b40eb515663f772a10431c98afbdff58
BLAKE2b-256 96307aafe07f62f3e9bfed291fed704c5f29aa04999ca60cde4cd19553e125e0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 45660bf423dc5dc6c2a6dedeb60811f957f39f0f89a35776547f9cd406b291e5
MD5 7efbe04b7beb6b466d41aa4160cb20ea
BLAKE2b-256 a30f4aebf081eb189203388aa9f47d1f2afad239174eb4695b2bf0896044f30a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 98f1914ec152a77096d9b96484d6080ad8b83b3f108eec12e858590b22e3465e
MD5 a0db8ea033fd033ae94783333748aa9c
BLAKE2b-256 457837ade678ffd5326a0f678fb1e69abc463de950e68dcd156e64e070496a15

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 431143454e78495ecd66b07a0e789f47e9b9e42d6a0e2f91af883f8fa08ba144
MD5 6856a6271636e0de481e59fce61b1fda
BLAKE2b-256 51fbc8f5eaf60b710d90077feda8fbd866a9658368ee824699787f9bdf6ad9de

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 12dc1db2e92488b9261d5fbbe68c4529c2b9af6b6aa2a571b9d08e327780a626
MD5 092837158d8877ea8c4818fbe9df910f
BLAKE2b-256 c77d5062165c3002754588954298f723925e370565e956a00d7cf1bdfea9e57f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ca8a0364671de62bc7d7d963b74ffda70e064ceb69924a2b428a44eb2b65ac20
MD5 954f541b9e1d584bde1735c464a5a5d5
BLAKE2b-256 10168cf552dc0226a7bd78d104d3053117092ffa391f93f4bf792bc81c74c6a5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 649619c71c08ce74faf65643409cfce97465aeef8acc54ef439f6e8b2677af48
MD5 011119f30830d49908b4eef6659d0b1c
BLAKE2b-256 a0df7f58a0019536886c8ec044f235a46289979f1ef836a6c818494a5daa0fa9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0f8921f7325bac0270f5c0b31fd364f5e50945221db5371522c5857731366ae3
MD5 1632e63179fa2fb49e382133f157138c
BLAKE2b-256 1a3615653f761fc1ec0a5bcef444bf391f1e7a7cc934eb6a6f8269a42c618a55

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4fbcaee60208c3b8e1ee95092db544bf37d2b43f2440c922e498f6954aea970c
MD5 07fbb901bf30d55cbd792d83594d551a
BLAKE2b-256 d716b7704c1da194496fec80f22c5c90ed98cdc9ce24c2fdf1c4384d7fd5e67a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9256bd5dd348d3bf69d90e42cc6ed04b614dc5309b061b83458b9dd797f83753
MD5 bd46ceef8be7b43dae665faac24e00e9
BLAKE2b-256 09f4ae6a13501fcaa7261feb8a43e69ea4b64bcc714830abee40520c584d7403

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 bfe49113fb4068da4a6acafeb00ab6748fb1afb70fa28edf97500b72f45cfafb
MD5 ee023a9d83829c0ad40fc46021a8a762
BLAKE2b-256 2909157df13002960e1f1480851b9a7b5283231474a8cff2baa8752f93399154

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6d193e9a37dff7efe998c3d10fb34c3d021ba7d29df21e7dc294929bcd619180
MD5 09dfe3335518c2e573416eb54a2d9410
BLAKE2b-256 dcebd2741f5f1c99114e468d48c739b97cd727e1e5878393c25e4bb0075a298e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 234d50e052f7fe81dc8f596254536080c1e4cd4387db23b6b7f2ee9e61634e7c
MD5 79bf64009552da0cf0f4e33a912c74b4
BLAKE2b-256 816baf8eebad6ef7a05c6ac46d1d9f55324619b42adc32c97f957317e7bd2249

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5d531b80af901839544e9c5de824dffe6bda5d7fcf6e46558de4651305a73f31
MD5 e19234e0af9fd22a681d11f5a14b3019
BLAKE2b-256 d50cc7dfdceb7f21912c401a4c1430ebd65cedb39cf82a857e52861a452a4ec3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407231721169663-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e8154c96c76676a2ee9106b4d3121c5963c7b51c4681e7121295547b65a9903f
MD5 810243547905d6ecc3fc12017b24f4a9
BLAKE2b-256 5bbccba8912c8f2f4dc12890c6cbc2ed0dc5ec4d234ac340fd941739baca3fc9

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