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

Uploaded CPython 3.12 Windows x86-64

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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202408101721169663-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.dev202408101721169663-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.dev202408101721169663-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202408101721169663-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.dev202408101721169663-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.dev202408101721169663-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408101721169663-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 f14eab6499f5542f9ef26eb8bcdc323e7a55daa9b4519df31a373e15a8b95503
MD5 0ae37d57985662c5eaa42906af4956d2
BLAKE2b-256 19220ac81e5cb488bb741653365b070e7513624ddd457255017cf6cca47bddf3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408101721169663-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 086368720e74c8f6bab632ff38283b0f9c4ac33dc83c686a390729345a51fba8
MD5 1594476e42783ee430146968778fffa8
BLAKE2b-256 051b4b575a0b04d56f30c4766b609d34d99c4772fee3818f5a248bfa47247ef9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408101721169663-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8d604a695b36026295eb2a415f05a6f4b6f78db6a291442fbc979ab81f4411ad
MD5 2c67cd0181f2fa937ad0044be5e1c2ca
BLAKE2b-256 b34641e845bbd96f63da996ae15390351c2f2464c4c60d210179b988ecc2571c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408101721169663-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cc0742cd7cef31995a61b0e01eadc97e371433b4532aa3d4c35b82cd7783805c
MD5 f9ec8d1652c9d28dbb7522486802d75c
BLAKE2b-256 92c931cbe5df73501bbf23bb17031a83f825de7a3cba6bdcaadb756a905a2669

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408101721169663-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e740e600b461e89ef128e2f3db79da178c7ebcef7291792724c1ac1a0c5e3307
MD5 7ab25f9dfd57fbacd0d3baaae2e44f4c
BLAKE2b-256 07727ba945dec4d6246564421849b4fb4b402f5868d9779630ef41313e8924bf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408101721169663-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 ad00a81aea02ee8c2c9e2d061825a2de0935544c208b7fe14ad15de9bb1a9c67
MD5 5da4a3efc791e33de231cf545f669482
BLAKE2b-256 25492b54dc542d1a8712b57a15eab175e8f8e3b624656b481fbc2f7d2e57e3b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408101721169663-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5d0620784b222ff7b27f2dac02138897badd8c0275a9e8e26fa53955d34b5bb4
MD5 67a17e9ffa9782b9c255eaa1a9a1a48c
BLAKE2b-256 00505998e1cb70f07bbe95538ee4aa9f3ea82c1f9b2082c44a33262ef2d551b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408101721169663-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3756f86002649a3df07027a66639a4876318785ad1b3e65cb22dd5cdd90396a7
MD5 be1a41dedca159a326e0a809aa900519
BLAKE2b-256 6229bfd4443c37027525927b7a7644d76942f4e43fe295797dcdf75a92e5fa61

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408101721169663-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fa6d9726d360e3dc403aee11881d6a4dd5d1aad053676c488c783352707b84fa
MD5 278c30cc75bcb4662622a0bbf8df9dba
BLAKE2b-256 39a7d71de8df0e12af0e14aed0d72e328387d6551e2adf270329ccdb04e862e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408101721169663-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 15e2abe7a8c42587ba523ccc5e8767cc0d0a454fbd486998e4d0de245f89a182
MD5 3bb4fca31519a0f97be468b6bf62436f
BLAKE2b-256 0e346363013577dbbfead5bd213a2d10ee409ce80c1b625dab102481ef0047ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408101721169663-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c4fa28db5f7978a991a851012d4a9f7ececf10929dc8a6e6064d89891d9b26fc
MD5 72c40d3443fbc5611c93d5d368e83cef
BLAKE2b-256 131d3d78c1078dc92fb6d9032b28d3766de997c7c90d773a0657081b988b3fec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408101721169663-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 430be52d0eebbf5c0db82c76e03da5199d2d9572396204758b5d37057e44285f
MD5 f3ede976b8244963afe71b640439bee3
BLAKE2b-256 bad1ecc790977fc1c88429ca9537131b87cabf80e68ca74af15b27f63590b2bb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408101721169663-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a4d069b12717e7b4455b1c0196722b46cc382d03abf1f07b1ae4fd37789e248a
MD5 bbcec6c45837970e2e8b97ee72091415
BLAKE2b-256 f58a4816699f0184ef7251fb865a300245c6de492bfe0d90e88b5c333a321384

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408101721169663-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a1959fd67130e8704f9f7d5ffe5334a44348bd69ac059d913ac6e40e9a757018
MD5 9707588eda30c0082d7cb1655f7c6a54
BLAKE2b-256 97f2135690b76653df57e70ac7b92db93f18eb534754652fadf7641adcd6af2c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408101721169663-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7ff0f700d3d3fbab2a9d27b23d9e7b29ea930fb1687a3d2734c4ed50d4bc2f5a
MD5 017df857c2395d69dec2f464107122f1
BLAKE2b-256 212bf6585c9e31d889d75b4cba6a27ea74249c7292312442d07fb2d5aee58833

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408101721169663-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 7d1a9e7a2e6ef7adbaaac8754257eccbc87082885881d6f520d1e026c869204e
MD5 d4c88a5f0bb7e15ab794f2a44ef2e544
BLAKE2b-256 6656ee91aefe3f0fb1f9d6bd98a07c53b5e9dc229dd73131d2d7f7ff45924148

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408101721169663-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 014c1d8d1d3bb7c51110ad32dfa58a1848411b61c38750fa09775fd80ed8659e
MD5 81131aa1b064ed1b8a102847e224b411
BLAKE2b-256 146335664ee71e222c9e916631ef8560c6f4ecf80214eb2bfc990a778217300e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408101721169663-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b550f7f2a346a53df4d39485791661d6e932614a64ad49493c225af43f40f6ac
MD5 f12ff07da7ed9dea092e41d0f7d0d181
BLAKE2b-256 c7e8de4c5f2c549a9fc1fb6b0b08e02addc8365c17aff4b57c1c50721beb18f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408101721169663-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 13f021a8bbdea657777dc95faaa0dba5c39d12e65556ae264d0b9e4f5938fdf8
MD5 538ac17d18277a6018b8942424af560e
BLAKE2b-256 b8db404e180fc8e163a5a73763f52ac47d297ccd39fc458a9d83ac082fed76ff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408101721169663-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 180fdea097f7cba65d2106a72ce95a2bec41340e1928c10ff52f41c029301431
MD5 986d482ca102212e41027debc942750a
BLAKE2b-256 160b65a8fcb90d4d481db8c5fee3e6a0c486a580fdc5efa6cd9c79011efd924e

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