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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501201731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 993880964ee851455c3278a326246352153ff3e445e23d065ffa66fe9de993f1
MD5 000beb22b58d1c0f09fd363018d76198
BLAKE2b-256 6d90e5addd3e3dbdd3fcd92b845d9dcd8c1ecff4aca07fab57f75d8b324fbfb6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501201731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bc70b812ead4026003c82744c314fa819158938724c23625273617a29036fbf3
MD5 b088a52530068ec5a5cbae7635209061
BLAKE2b-256 75be0d7e8f7a53be2be18e5f841624a4f5bc8e02f37af8897782e23965ba2344

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501201731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d38de08b254760e14a33e629d9f796eadd52e1011ab0c3ff036bbd5d347b850a
MD5 d75a5742a7782e4341c3c5cdb8a21d64
BLAKE2b-256 083d828261036d4385c978d6aff09a5411918973ce6f77817d1c98db8ad083a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501201731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 670ad73c035b3c2bc8ad180e79d1aed7251909d1aa34f1e743f62d7d284bcde6
MD5 15ed18f9b6f1a87e04fa522afb6d615d
BLAKE2b-256 cb5ef14f9a8f56a6f2796b6af8d515d0a26ba327602c730563021e1395c88ba8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501201731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 c59712ba8da619a16786b738e56b30bd5474e58d6a97fb94fe64012e176f3dcb
MD5 3f422a1837ffb821d73988d59993df25
BLAKE2b-256 d07cebc8010925b405a4f246fd0c17ce717445a17275e39fa4e9687769742c2e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501201731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 fdb13a04c2c190cfd47d32a2cb41a16d88327bd42c8290ccb9d371fc9838d97f
MD5 511e50ad0ae910a4191d959f2975e073
BLAKE2b-256 2ff93f16188910f3c81f241f26415e070d6bca632c059008eb28d55edb00aa49

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501201731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2e1a00e0944efbc49f1efaa7b94edb1b6f2ce40a57e9632597475f0544a77150
MD5 1a116afa570c5678def58449327edfef
BLAKE2b-256 b32fbb8d9f080e0cc97a47be1d8021f7ff93161b1aa4114a69f937fa841c0803

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501201731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 381816fa382cc6db0e1456a14a8c11234ff3b410456c4ae4fe1fc876e618962e
MD5 2f67a25c2fd48af5ee98fc7d219d0161
BLAKE2b-256 705b9bddbb6e2dc410a8328b0957113e3300b224aef446a4ac36b2f16b03f93b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501201731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7bcb48960f19e94bfb211a3ce856c9f1bd8cb25897de407db66e658cdba73f5e
MD5 e067fd48d3350a624ccea2d96a4fd293
BLAKE2b-256 c3211ed9df91206c496ca62f5fd3923d02f57d64f6481872e9496b025c38cac1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501201731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e3b5c518532ede985ff254d506b2172a8b1aa4a87741dc24550a4914482ef222
MD5 1b66d29f48599e9cde8c551f68b4f3ff
BLAKE2b-256 156354318281a0f8c2b435e775a8fcde49f16e9e56a32c115fe56ae2d285d27e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501201731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 df96eaf747b2e3f9a515ed31d92180ac15a44a82a34b11b02060a389a4194f2e
MD5 85dc6c932cd380aa8fefa18b3e68e5b0
BLAKE2b-256 afb1b380cfdd4f5cc043cfed70a2f8341850d8169b0c818332a881bf5fe2a8e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501201731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0df583a98094cd54b2c21ba9bb07d093660b35d1f1b097d4d18e3ac4562ffe60
MD5 b888f9276ab97ce6002f842c976182b9
BLAKE2b-256 ce9e07878ab1f1a28cb1cac4e0d5dc2160583667dae2c5a0f0256e754e0fe6a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501201731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 02bdae8f113e0a268f8864b60e40c26671ab3b9ab45a4aac29565494d2f125df
MD5 f5a61485e1eb27b41abcdc2d566d4697
BLAKE2b-256 3eff0c6bc30fdcfd408a42618862e454cfa0198d00e9dd65cb660397eda30fa0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501201731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5f6e014870cf3ba9ba58aa8ec23c1fe805b3dad2426e0567a29e06b6e0e0606f
MD5 2303f6a3d74b31757ce7438475b5375c
BLAKE2b-256 cde6c43d3aa19c60baf427b5454deecdac46ebf275cc2e2a7603e8d9a8c74954

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501201731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d715d71b13c0c5b5bf6715bcf4bf19a80987312068a0f7d1d2517b75db8d633b
MD5 e75a1a55a716c1aaa2d28a88c4398e3e
BLAKE2b-256 0aca7f52dad3486eae2accd4c5a6a0504424ff7dd39baebf5a110f118fb381d8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501201731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 273e3c7d58c9aae5193ddaf86de32395bf57a64b0d8e8e80ccb7b907fba209ab
MD5 f9218374d51ce78c59ae4eea49fda3c0
BLAKE2b-256 13f18559ade233fc7dbd4712651e47d357eb69bc6b31e6dff150437c7eb44c43

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501201731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f38f05873d2b4955d5f2ff286f7aaf46393168e41a901844e57974735c0fadd3
MD5 415c48a71c044d79f6ee5e0f47d49703
BLAKE2b-256 9448f822a90b62879648f4551e0c3e694ae5de7b275b6275d7cd38911de440c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501201731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 881a500c8e0770d2efe696555d1dfb50e51521766eb40689856d98039e2f5cfb
MD5 e3392f1310d33f23af066c32ef0c75e8
BLAKE2b-256 f88560494d2c2c5d11b7ba9e2dc51ccc96c975f8c7dc45b4ed1aac4f85db8437

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501201731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e7ec3ee33c6f0f273695e337f5caa43f0bdcd879243c8e2ef423770ea2029c84
MD5 0b53874cf71753b5bd252c6f15b9f3f3
BLAKE2b-256 96995b7fbae79de427b0cac5f5ddd929e8ec9b61cfa44102e4406cdebc09401f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501201731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 33f52b914be3a0c2219611e501aa5f659701ec3366f0f7e6d0c24376905fcdc7
MD5 093a389d3ccd68621841220f58f31dd2
BLAKE2b-256 a662bc7b077f3db3ab81090b331a767aa9680bb7c8d32bf24a1b48d42dd8851c

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