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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412071731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f6c3db748d36450e7cf95105d4a709805419258ce64661d1eb3ebe97c9f52efb
MD5 aa93ff6cb5fd16c2078da2f21e95359b
BLAKE2b-256 f469986fa270b5aa6e045c9a73f918d8866857d6a521903542dcd5ed366160c1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412071731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a96c9a95d545b673f6cf0f77f1c294decaaafc75c2ed94a4219588d7809ad119
MD5 c716fdbcf1b440c715d73795f8f52378
BLAKE2b-256 0f798893f1a1b19df320331dfd3b599912007f6dbd21f81bdb61f416df5c7374

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412071731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d6b5d83cc4a9706d1d42824bbe7a927abef0b1a48d55f4164e5b991556147bd3
MD5 22225a247cd01756ab3bdee7e654e44f
BLAKE2b-256 996891f655ab19ed23825cab4c4b8d5515d603109fb2514cacfdb274ff279fba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412071731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f20b636612e0e5a0ab91aef3a6304c630c733073f22e1b2470f159d4b1e54a9b
MD5 b6eef40d21b2754d082363174737ccb7
BLAKE2b-256 8f099cbba8e5b4224376250a0e88571041e4cfc6806459d62008bd2ccf5f65b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412071731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 6f94d8c10c5043591e71ba01ce87694297597a69cd584c00438e71d65ea3525a
MD5 52b804bdac4f29800ad4925e4f49e909
BLAKE2b-256 ef6658ae2fdde5e4515fc2f5fa6b1d0f284625af7d4cbe9bf01bdd4f5793d375

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412071731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 15bcbbe83fb3909d06ad9b9703525907a11e73a759f9bb65912130cd8ae3ae48
MD5 33462f21318885d75c0214cd5445d01f
BLAKE2b-256 38ac7ac4af9982e71e77a6281eac9f4a0748a38c2cd31000f593d49a544325a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412071731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c1d99ce69a975d7978ad3a871978239d6e956369509c789206a3d367a95f2b24
MD5 21f2e00241fa9f6f66323beda562df42
BLAKE2b-256 7b5ebe81b903625cf893a59d16ed85673c507b6072ac1b9e1bf9a033ba8dff5e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412071731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6d77c07e612efe6b79b35ed40664f6476bf7c1955e47d4c9b1ac03a07c935908
MD5 980b7152df967c1de8e1f6fa95d89063
BLAKE2b-256 e652c42c991f2d284fff12e422366029e20d41529336547df7f83af2a4eb6f7b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412071731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 86fe62f71f0e33093501ab6a8c1a26529aced029ae297cb3136889a0ad3bfd2f
MD5 e5d33b66f7e5dd82220c8c6a1a0d189b
BLAKE2b-256 975bdc69de94f89ea2905c43ee668c0803e42405fbf40f1efb3848ce134b4170

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412071731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3f002a33ee7f9d4981a3790eacc643c2239e43ff78ddbcc2764a716a3645d122
MD5 922354da3652ba08c1365336ccbe27ea
BLAKE2b-256 a087fc314e5c5ce0b28919aac4f5ca3db39f494f3c565f5f3b2c6edaa5cd7d85

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412071731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 0594351090c31bf48fbcefe5e2bdbe52f8c81aacdbe6c525315e3b174c367e85
MD5 edc2e3ef259d8fffd460db5344175eb6
BLAKE2b-256 926687718a426ba6a7092411f514ace8988fcb82a5a692d269f95daefd687f57

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412071731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c3974da4de65fb51dcecaaa7e98105fa50cbe5d8ad5b1d88b4a796ca6f3d6212
MD5 5e5e13acf1d7e392d3c4aef5bc8e576a
BLAKE2b-256 67c15dda65dd2620ae2ff01823ab5f2caad242171f1501c706a3ba491804b436

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412071731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1353535dba3424c20e40daef838177e13a22aa3f0a7d4f6ccb463261cfe17f99
MD5 386fff6495b8810215a638dbc9093c29
BLAKE2b-256 0f5768926f10ebd8c4912c4924175745c14ae4a0861bba9378dc96cd91b507a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412071731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6a62a9045428cd073f5d94d2ec136f4e007e1e516ab3a455444dbbac0c58b988
MD5 b3f568d678d3d766aa13e3a3167793cf
BLAKE2b-256 520844e7d4695e674d627bc733fed396c5351fefec90c84760689dcd713f2656

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412071731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2f12b22a6e19bb5efc55667b3d8267e2c58c74e9651a4a88da0d74d25c2ccbb9
MD5 89310dc5697a4bc43e4c4547c9565748
BLAKE2b-256 934fd6f4488f368caba85a08398910c7ce2852f582fe5adbad5f6cb5b3cd1d39

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412071731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 033b5356e551f08618a51ebfa6ca8cabae92bd66ae48791d3aa962aedb3325bf
MD5 a0424e018e4d444e9769a938f54c6797
BLAKE2b-256 86c90d2b3bcbb1d006cbdf588c3c8e55f7d842159c60503b5e058075f4bd75cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412071731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0c8c7a3aad43b3ea67d5a92d1b0846116918e2a96ad0acd4f62fab1a52b127e8
MD5 5d29820ce0c19cf43ca32c89805a4859
BLAKE2b-256 18045ebaa7d263e5424de668c3566e8be5ab5fc80f7fa72daf67f721cb46e4b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412071731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 06bc8a97796b99a641322e8ea02424c4ed677b732ed74a440065b1aeb961baa6
MD5 b3f79249afac0e0a924d0bf22a6a90a7
BLAKE2b-256 27a0cc4f5674555b1dc2655ceee2989dff53c25ad61e336b7308a26c69a57d28

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412071731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8767844cc904fe07b6b948786849e8943ae6d1f30506bf3ec931a82121c60ed0
MD5 649108b8fb4deafbffbb1d6eb29554d1
BLAKE2b-256 65839a1779fa73de1e09f1f765429c8c64b8ee3c3bd99d4ce99523124e9df444

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412071731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e372cee89f76de0f74aa1b763855d84a7d74cbdcd20112cd02009fff82a321b6
MD5 87c51954550a6f89885274980b21b58b
BLAKE2b-256 79e1744c73b7bcac542e24a07b78c885130b0b55d04ea71c09efbe893514794b

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