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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412061731932516-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.dev202412061731932516-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412061731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 9d0da73d3a8c720169998bcffe3567e7f3cf55263a0ae217cc47628a49f4648f
MD5 fc85da297262b2654be47e7a434c1214
BLAKE2b-256 ab8a275760112c25f45ac6d960ba7c0f3e2fdf4d5aaed56c03496a12526f1452

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412061731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 95ca40de32d3fc732cb0a667fa130b61074677bf8c5f4c72b0124452cfc36068
MD5 c2cf95ce334e24040977e1638b3c8a6c
BLAKE2b-256 fa99fb52ec074e13d86afbc5332d2dd658d275afa8c94ce671793a749393048a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412061731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 eaf2235ad960ad9d870559d1e83f7c311ce11e2ae5b631b8952b99d6819fb0cb
MD5 1b4913a045e1f8e9e03e952766e62abf
BLAKE2b-256 ae93fa9ed4ba223c5282123a1a5121eef3a352c8ebb6c936890d8752d0a7ed45

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412061731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0d29cddabafc52019a6f63e4ab056fb812f53b287710e8c8b1ccafc1f8bcd2af
MD5 83a6fe948386e3dafcd551fd43515b6d
BLAKE2b-256 581ae31ca8d8ab694b6a5850b7153fbdcf806e0a6b119afb5a552b0dfc529670

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412061731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 120bae7a540753c469be662d35da14f3c265351a7566454b69d2f83fc6a34c78
MD5 cf6448884e4f9590c1e14e5a323989ba
BLAKE2b-256 62ae355f80c94d2b1657173bb4ded8ac9b5bac2d703a3ef4e1df931f38cf0126

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412061731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 916b0b49157f25145beea1ce72e459efd0de68a5bd0137767be51f63259e9924
MD5 3048f8cd8ed5aed496aa42776e71671f
BLAKE2b-256 55b798e7f09abc12b57a7f8c33336604e58048db54273a8365781bf27df5acd0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412061731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 08f5680d5ae7fb1bf2ae13f2d78996959639f7d3b7389e5523ff20a582f13eb5
MD5 22a41fdc5dfe750b15a4279949c51806
BLAKE2b-256 c1078d78bc657b1583056517ee4265116a4b4019723f6a544a6a35fcac526689

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412061731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 36583a77c0c901abdd4990591a1a58cfce357f29dd5e50f0b21ecf3dfb0f0be2
MD5 3197a68837815a77c4a4015531d4ce84
BLAKE2b-256 1cb0e5c653f1ba7941cbd7583ca9a133a703d4a7a9244fe73992d14b2d7fb8e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412061731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 da430c38fdbfa154ab581ebca7df0142711dcb810743da26ae6f5141231187a9
MD5 aaf223fd8e3444878c71204007fdcd35
BLAKE2b-256 842a28a586ae87e4b80c4b9511467e84cff0055acd6e042d18d9409200a1361c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412061731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 18c1e6970bde48b4c204e7f11f50b0f9cad7ac258d7f7728e179b9024ce4d4a4
MD5 1e75b8978bba18537b67cc5031f0907d
BLAKE2b-256 5f584febf8541de0ce027b1ec2d294887c144f9cd873ad8a325b49583bcac78f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412061731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 9f8186721e6a74f5e6d14ac3591a9aa862b11eee608f7b7d0fcd93fd76198807
MD5 72f2343bf48d4c44c7650e79238923cb
BLAKE2b-256 17a2e2541a4360924f5ceeede0b7cac55cd3b033adfbfc1112e422abd76402c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412061731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 440711c2fb829cf720889093793cdf1538c50daa1d2a9778402f647d37e81a36
MD5 6ffeaa963dffd9503ca8da6f5d75e9e1
BLAKE2b-256 75d866ae325d08ad9aa133b50774afc44331c37bbc6dcc5589a92cf009623c29

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412061731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d27e7f9843bad5e2b6b8c58299307845b8686248116e3c79722ed9f21aa841b7
MD5 79dccbe984bb18102dce7786f68ac3c6
BLAKE2b-256 2631c587e0d1a6894f52f28a405dfc03dd39d8e6bb2d6a15069553717255224d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412061731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fd371f25841f6963c7af0e9d5d54cc95fdb100ae898432ae838c97746c827a34
MD5 6c0b9848c57a42efdb9b4080c4219b3a
BLAKE2b-256 b2495ecd3c4cec62670d5b4126764fd7c0ad4d3c5e61c7b9e73375f9c79048b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412061731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 07df3b20c44d5aae3d39d7dae8f36b8ed741c2b7b0bff1c6edc0769cb771b443
MD5 7f8a5bf8e68c5bfae918e4edf1733ead
BLAKE2b-256 54b587ade180ec919891f737823f29dfc6e22c815b8f5d0f2cb45e3f8f5daa8e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412061731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 26e76eff84fef7b652b0959244dad6d1525589a38ec82beb95036e4f59b1de32
MD5 15a969c7a94f45c0a8a9d4f5f8c99f71
BLAKE2b-256 60416e58d760efc4bbf39be988fed3ee2c606fda6310dd61a8624798e6633896

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412061731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3707c2084ccd1d5a439337493e2711b6627f61a039c821a8d06556fd988a4a0c
MD5 fc43e168261d569b87e93e1d0fca7695
BLAKE2b-256 474650abe1c6c48be42cba1ce9cd7e53f6f32280f625abc519d2681c8f9ad0bb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412061731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8c3259a92c5be87643ffaf302433de3a373f3f21594dbf5601159dd425c960f7
MD5 c2bac3372eb097063cdd7d7ebf9a9605
BLAKE2b-256 5868c47570cf4ef04962caf10a69ac663c9fa3784f7d913ef5690a2ca60a2506

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412061731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 57bca299f47341a1b2aebd13cd3eafb5d227ca2dc571000bd4109e5d327c5405
MD5 f450bf90ebaa780433edd431afce13d7
BLAKE2b-256 985db68ea926050349e1c903cc0dc1ca3344660c11b329a6f84878f59107a7a3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412061731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 af1e711b7409b7ae3f47eb9b7c9a7ad7bb065a23a9b53b312eeb650c4efa52f8
MD5 c96bd21f8644384700245a05d8cda18a
BLAKE2b-256 31e977eaf92baf8c67b82a0ca04bbb9ea2c486bb3a841c329c5920c030f942db

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