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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412121731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 0bbc17226f6cc343621d29db6c786094c4dbc4e20592d715c2f605e19b2877b4
MD5 1b0d5ee56706a5b4be5934f674c69135
BLAKE2b-256 d75d9b8a2c7b8fe6e84192a742e2a7d358e245fcfc65b779cddbbc43fb8baf52

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412121731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 221ed7b924a3d29dd60ca6f9dfdcf2ae3fbcfe388a84f32d437750000d28d9c4
MD5 1bc8372ecd18047154efab186068c7fc
BLAKE2b-256 583386d9b22c632f5d11f3dbb4be644c9f69c7be5db40fd95cd714162615c282

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412121731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d0b3275a40c724664e4d5334dc1fa9005fcca03af33a94334820db136998578e
MD5 ad72af724922bd0f63cf7b7fdc2b207b
BLAKE2b-256 fa214e031bf5d82d880cd44b1761e110cfec202a3c9493f4bdf83d8d95eb5e1b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412121731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 eeb097a4c91426b33f4ed83f1a1ffd18940ad80b96af41e3e7bf0e49c53a7537
MD5 fadd68da841509c12486366eb30d668c
BLAKE2b-256 20ae61fed9d5616dbd8563d7e9798d348c8f5185dbf9983d34d388dfdac24b59

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412121731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 587d48b697c885a603c9de65d8a99308f47b95d90bada4e36a9d21f52faa157e
MD5 48b4613a6ee33b6dc14a4781e08ab37b
BLAKE2b-256 00744dd0cb309608b64407c244c967a4de26327a67301c3c73806761628d8c34

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412121731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b93dd3c40f282c7ba1fed20c99ea6b39e3fd79213561a0fcfb20a88ee9453225
MD5 0b12754d7b4dae382667734bde2271a3
BLAKE2b-256 dc472fc8decd12d62e627d8ce5c4f5decffaff7d61adf00a2dd98eef791417a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412121731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1a9d568633e59e204eb75e5c77c290916005394ee81516f6d1adde7b5b2a4749
MD5 f640d3ad98fb58800493c252259c786a
BLAKE2b-256 467fdbcf53485b15b022527ec4406b58446bf334805d9da4ffacf383de3d788d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412121731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0f1558b2f0b805dec37986a5ed522810912c2fe5a2041a3d9f9711b400374f11
MD5 f1e4a9ba03865bf705b6c110fd35ac60
BLAKE2b-256 5f1c8650e8011ea287d6b05aef81b5e48ae4ef67393d9b3e0a99ab775ba9a46b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412121731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bb21eed47902be179e91b2551047af7b7b1a70d9bbcbfa50ef62ec93e90e99fe
MD5 004dd3733b86564295686ca187fefc30
BLAKE2b-256 2eecb0dba3ba1bf7dc95233fe585af7f2cf8c1054caa0b0561d6cd055c0f213e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412121731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bc1f3711faa3e15d7c0a7cb7d30791c9e11016c0bca185f373825eeca211d10c
MD5 72c1d04c24e0adffd5dd7141e347579c
BLAKE2b-256 1179cc37b0fc8fc7c4771f660c656e65b222af03f4b2c916a6266c598a646c4d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412121731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 88927cf0466dad1a3da8b3fab027627af0101e9f43f8c59fa306bb85e0ae1e6e
MD5 4f5f0fdd7267c7be0a2cd6767afb75e6
BLAKE2b-256 144af86c818a963216d1ab724407b1052be529203542170706b862630a66057c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412121731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f37f97acdd6af791e07fd79138c0c25ed348347c1b3cda4df767abd8d257f42b
MD5 15b720ac16e72eabe12d1762cfc36c66
BLAKE2b-256 6b93f7daa98c3c632ea784e6e6106442e1a30990886de9b2c97711abc2e2ffee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412121731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0ba3e38a9575932ac901f335d58ea7fdcfc5bc5a63e34d99e4ffddf03f6e4ead
MD5 8e5b8e426f10b28e64a38ee207bd65e8
BLAKE2b-256 e9b77aee2f921c498ca82e34fbb308903f281ed10547d3b88893d2c3dda29339

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412121731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d309b2bce15de298717716c801ce3442cf267d3cb50ac69ce414640ca8019144
MD5 4ae5dfbc7961a0c6f57bb16f82845460
BLAKE2b-256 76b4ba3cfb8c6313b0dbb95fc2ef9fd40f01bfd57c87c1303977b803e3539e91

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412121731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c386465f0926a90a7c550ec96275ab530fa3e682482b05e8f8402a8520fe7c91
MD5 091e1ca9084795cb8accf95eabb8e46e
BLAKE2b-256 6d614b73e51eff38be049176b69a53d45db285b76d75a0b86c2a7ace30f769e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412121731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b1234035b9915b6564e5cc8cdd0c8afe86e74569889768cc63aebd534e7247ba
MD5 fe6321be9936b93cc15c6d5cf54e6b57
BLAKE2b-256 eb1731af20cee825f8bb1993174b977038813b8e620bc3b84d4de94d65953ff7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412121731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 495d5f590024a8e9665479f1072b67ea642d126caace1173dc6f72cfc8c8fe91
MD5 db36da61e34a70be7b5be71abab1f0db
BLAKE2b-256 8a04c00405d015b9577aa274a6a0435f1be928058e62245d291837f7cf41a4f7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412121731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d990da2884800a0adff171f296404b2cf130f6965539cb18bed0f48463f127d5
MD5 b0987ed0f76d7d3371f638f8d5f5db63
BLAKE2b-256 9941aa08a8a9cfef907e260c7f7919cd99ab00573012c9c274a8ab30cc077e65

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412121731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c65f40caf277175b5885a6786275ab4eae33a85dd810d06d333f7a5a448c7bb6
MD5 59df2a2072c28eaf004d796b894c83b8
BLAKE2b-256 29efa31283a44a68ffdc59a2ee9ec3914e2bc857dc29544a2950427541887bb1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412121731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1ca90f81e59b8e4fbb5dddc61718324bb01bf3db83b7418b0b03e0758c34c687
MD5 9ba457674b387cd54322eaae2fd0431f
BLAKE2b-256 4e056b73e26f89772ab36ccc152ed122ed5658b683c30801a40c0ce47c82c5c1

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