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

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407161720982427-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407161720982427-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.14.1.9.dev202407161720982427-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407161720982427-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407161720982427-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.14.1.9.dev202407161720982427-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407161720982427-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407161720982427-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.14.1.9.dev202407161720982427-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407161720982427-cp39-cp39-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407161720982427-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.14.1.9.dev202407161720982427-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407161720982427-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d9b2aca8530451fb01d4a7f31d4449a3d4f5f63fec7e38c92f0b7f784971a98f
MD5 8f55ac9cb1097db6015f1780cc50aa03
BLAKE2b-256 d52784b548d60b41639ddbf59833bffc1c1a4152b02375730393def7f7caf4ef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407161720982427-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 50c22419d2e9838d21dda96980fe3cfb7adf91c3ddca1f15dac2c407ccde22a2
MD5 fe1c0ba371dc3e852acfd5e43c986450
BLAKE2b-256 f0109b8bcadf078dc045f0708ad35546c4a763e6cd039cab1afb9f1e0369a544

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407161720982427-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fb47b1f5b2c376ec15afdfe8f240159039e6eec765eadc7d3b748298cbda3451
MD5 c8634c4a13c24eb7c8476266d0e014bb
BLAKE2b-256 97b41c5f267c027293173f4c664d07d7ee85e51a390122d651d3f3543da71236

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407161720982427-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9e2d2f4e34b5f42c9e7af266cbeb97131faddfbd95220b2be1dd1333ef002b40
MD5 2e0cac463e33c050b8cbf9bb6eadaeaf
BLAKE2b-256 a1f6e0c9730f2786c860fbaca4530c0adb32cf0c900b03af8299d7269e0959bb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407161720982427-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 69863d9f70696cb870d304c0afe9d8614392cf2a149fb65546c27511d4d36af1
MD5 bc7bf6e7db7594cb0900b8f311d83bd0
BLAKE2b-256 d55cdd387a869c99858075e6588ab229037cdd29a1309155c5ec25f7afb18b78

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407161720982427-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2b351482a7594bc8512059ed53ca2ea596465359b61fb1a751a7b5cf2ddb129e
MD5 10cee3c9adeb4ed6ce62b6c21bee3a7f
BLAKE2b-256 ef7a61348ea047796f8062b7d2b025f4625ff47ffaf5b8186d79048ecef96812

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407161720982427-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e3f118c221c7a25269a557a19cf8a37795426701ba2ee03da1f2cc84fccd67a4
MD5 d99559dac2001e8076966e21d7110179
BLAKE2b-256 ed4789110fa00077bd85839b2989f27f8f703e9ad7e383fb1c4846ce742200c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407161720982427-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 760811a2d62beab0dcad557bc595dbcee86127682d7eac475908803115cb4aee
MD5 a03edba2fe0766c1e8c11803cb4eac57
BLAKE2b-256 42075f16c2b2fe1a723ba317e8a963ec28b9c30c76238f382c1099be4a72788f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407161720982427-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3849842ebe263d2e98f05275e4c573a9c2c22a6c9aa67fa096bbc1c5c68e4dba
MD5 57fc3abd542f6b1189eb80f012b38e66
BLAKE2b-256 d66aa0f9b09dea0cddab9679718b94cecbe154b2624560d1298eefb780cc9884

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407161720982427-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2bf376ab0802785650e0420e675071fea1b9802d70edfb361edd62382dfe9276
MD5 92305d914788cf8f1ba01035f85598ba
BLAKE2b-256 5b9fb7366c2d836f050c1e5383b104cad13e415db9e8335cd61b5986efd6ed92

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407161720982427-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 9d9652d7de34c9b7927e6622ddc1ab77c811ee31b6c8493ec4565b3b52df3e97
MD5 8783228cc1113eed1f1bf28f4d4c261f
BLAKE2b-256 bf9501f1e277fffade06efa0030bbc48020a43b06bfcf44fe45e2edf3f81dc2e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407161720982427-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4fe01404cd43e27da40cc3a35c6b6850bf6d8c01a6c95acbbb995fcf9012290f
MD5 0b79d5abbf9e5941443b8aaaf25199d8
BLAKE2b-256 5ac9df94701a70b820ce99680d0b6c22def22b15f29517c382608f92eee20f14

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407161720982427-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3716e8786a3269fb80882c42c9188f86bfb56077c1224918a9bb68e8573edf38
MD5 63b501f48f87b0151173867f06546994
BLAKE2b-256 cc12815f86036f2dc424fdf44406e87f1d74138864d6d310dda223d77aaf48ad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407161720982427-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3c91408ce567b2afba54667885191704116dc0d910f6238686d5167453958e0f
MD5 0453a8b2f12b50630d413188cb378ec5
BLAKE2b-256 c3fde7f436853394bdab4fd61be616f2faaa950d25f5b051bc056a1bb366062f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407161720982427-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2dd45348ad896d16e2853b399c66ffab4ced80fe0d5fdab8c8642dbd5e1255f2
MD5 24270c0344ec93b1cf82dbd04ba7aabf
BLAKE2b-256 362fb45e133e73e6cda15d6bec81f641a421b418ee93a78b1f26dd192c2cf8d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407161720982427-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 e9d728c0a070c131bc2d5b74aae652024eea4fd73e56a96b6a574816e5ed9ddb
MD5 811ecae98dc5475d0d7c0bed23c3f142
BLAKE2b-256 35af0d931c92726a80c210a54b2ad6263f62b7fa60173bc6a4e15faacf3db76e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407161720982427-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ec159303157c515edc3d97dc1b967761bb8d7d47d5ec2c80b0d26a04471e31af
MD5 dae8a4e8a84ecc517140cb75cfd2d8d3
BLAKE2b-256 9510f0bb14c50cde914016b69b01f09d767997fd2e8d017673f83e83ec8a2419

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407161720982427-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0d206ed0cd9e45cb78f28b90ae05ecf75392c0a0bc93b49f02ff53f9ac1e72a4
MD5 8778b694404eb1c9115de35c6b3ef13f
BLAKE2b-256 c9e0c271995551a9d2cf7ff271ac9d192d14ffd8928f449b26716ce0ad4da5b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407161720982427-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a9463ec6adfbc74c28c731e06ee68fdf391abbd362cc7aa0b37c8db830fb46c2
MD5 3dfa488b40e5b96e4e3312ff96561aa2
BLAKE2b-256 0c9b449f1559c21adb75f4352ea05641d066fc9041a2e6e21d6d541ab863304e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407161720982427-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 938a1899f0d24167090eabebf2fdca8c6f862f25ce5865a054571bb5fc79346f
MD5 ab87b72cb5230eeef0c1375ce2ea106c
BLAKE2b-256 d9815304395fe712c472d94c48dbb22603be38a90cded8d022a5408e84bb438d

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