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

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.0.dev202410191729248609-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202410191729248609-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.0.dev202410191729248609-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.0.dev202410191729248609-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202410191729248609-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.0.dev202410191729248609-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.0.dev202410191729248609-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202410191729248609-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.0.dev202410191729248609-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.0.dev202410191729248609-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202410191729248609-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.0.dev202410191729248609-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410191729248609-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 ae440b1e86c3dc1b27403fe32fd167510d4a3475e2d7cfda8fdb51b651ff765d
MD5 d1e2bbceeda08aee5e3dbd0a3a755572
BLAKE2b-256 df6cf58b1ed66e2710cc9b27a6ed305c219130de30950ae6db1da584704df2cc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410191729248609-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410191729248609-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f35ed3ddb585cc18f236633690d9b9a2fc6dc89c884561cc0e4ca744a2812336
MD5 824ace49454380878c2eb66d7194b994
BLAKE2b-256 e98d5c7514cf7700ca654f1e2787c50e11b486d11663111a0d467fbfa832917b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410191729248609-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410191729248609-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f239de7663f845376ac11b19d6fbde4d28d158a701b0f3d7b3adbc5897a6891a
MD5 c6610d21ee2472e050aa37d345f89ebd
BLAKE2b-256 6fda60b607dcbd70d7b51ab76d2b469fbedcf31d9c99d9d3d03f307622871e44

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410191729248609-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410191729248609-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 37ffb0770f1516fac304c02c9530a8911b6edd8e4b26954fbb34d88d7e74c2df
MD5 383f987262e9bdd87b5ed2d28c0c0484
BLAKE2b-256 c8144170332e568a3768bbb58c88cef71bb9a94e1a8524b30682079fa5fd5041

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410191729248609-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410191729248609-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 94d0cc802c313aff633856d3bd64bb91ca1f2d416c16622f5cb1d759b483d881
MD5 15c61af1bc29b99a57f42336276efe22
BLAKE2b-256 bcde79aeb6b34520d074f4d35fa73fa78133c2f8231b07ea39a44c1d9c1ed06b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410191729248609-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410191729248609-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 7bd83c552494618d9f16d86f35508bbbd963573a7345bb9046274051fc9b0f93
MD5 08c8a6d192dda4b590f4f3a596ce578b
BLAKE2b-256 7ef5248c22add384bdb422e51086e03fd5a08fb34c439206927fae8b77113c6e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410191729248609-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410191729248609-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 df35a158f9d861a5da61b3132fdef13fae4dd5e297fedc8dfb983633995cb99b
MD5 1a19bdd3b24bb1c0ec9df9cf33b56c07
BLAKE2b-256 301427bfbfc97ebeaab26cbad387df190452e97b43802798feaa703b2a686ca3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410191729248609-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410191729248609-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ebf4114b02ddc193b2bca279694fab6e9f53a94d389e1041d24892c0363ee523
MD5 d5969fefd75c8722c1abb7635f0f5234
BLAKE2b-256 4624dcc3bb96b8af8370523921e831658c991a2bff164fabad4cad00853d0b63

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410191729248609-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410191729248609-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7b391d150b521e050d53afb8e7bad27f10dcd0aea0384ae2a864d74b4469f673
MD5 475c5db327df02c7f62737bb7d6503ea
BLAKE2b-256 bb90950b65ab9deca95d1d8b44401d5eb91dbb06a391db8dd6de4b65bce405e5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410191729248609-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410191729248609-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e6c5ef646637d6d47bcec0ae407a9fb2f7eeaccd730190dc3b1f98d28427e3b3
MD5 310f9100c81b0f2a39910054e51a4da0
BLAKE2b-256 df9eb3543fbb260aa20433a38b8d586169a80aa27afff6ec6e845b6bc7e234b6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410191729248609-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410191729248609-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 83747a6ccfefddeebc1f69dc130599f771159481ecd775ec5f6e5c95f06375a8
MD5 ec924680ac0abe4b2f603bc3ce730d1a
BLAKE2b-256 ca57fa2824a6cea0bc461969b8fdce6feedcdc3b280331ef51fa74de4ffeee4e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410191729248609-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410191729248609-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8e4967f6c8175055d021c55799f0884242f460cada3f62c6ac79337af1afede0
MD5 a06088520c5f0ce48853f36891800553
BLAKE2b-256 bd6dec917e9733613096e0738b74fadd86ace9e8f1364cc8be98006f45f1f462

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410191729248609-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410191729248609-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 09aadb86e89d55b2d64c6b079f7dc4601b48f68a01bb8487973d33bd9922d5ff
MD5 1bef0e67a0914a68dd5ff974e1fc03e3
BLAKE2b-256 70f00df5c535ca210374833b8e7d1e96a908c8e180096f7f22e097469a9764d3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410191729248609-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410191729248609-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 365564db0897bfa6a927bac5ab796332855e92448f21dfd5cdb052d42ce27802
MD5 ad9843ab0a01ecf51bb84df0a532f6be
BLAKE2b-256 75b57d5fd19ab522c3ebf67983f3da0060fc6ebb78cc7abb655f9e3775204ddf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410191729248609-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410191729248609-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3c6e0573b63c0b8b7c4bb0192a7a1f895ec548e5ed26f1853477751d8f77fed6
MD5 67f24a7056ebabdf4c200d01f610ca76
BLAKE2b-256 68b9c0df7cea8315189c7b0185815823d6ce640bca58db918065d380e063977b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410191729248609-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410191729248609-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f3000df494bf7afbcc2fa729bd11e6303a47af3d7ffb4fabf3cabc7830c77dcb
MD5 744fbb4be2319ee5d31e7829b7a9cfe4
BLAKE2b-256 c7a605daa42afdd3e1415aeeb48723cc237e75eeb234238e0927af2d9cc26ae4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410191729248609-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410191729248609-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f354a4df91aa842564b0d5bb8ac44008a066f5b3d468fe06054240d0905f45f1
MD5 c4a65bc35d7fff51e6741a3525df2ab2
BLAKE2b-256 965d0b130f1ecad93b00f5f338adced76b1e085ad10e0d69f9eb5e5226db63c4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410191729248609-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410191729248609-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 09be871c35dafec63963508e668629af0a89db8d01ededfe8b4bc4f1a6c93225
MD5 d37c3ecb8f8c5e6cf7c62014298eec41
BLAKE2b-256 869b0520cdbec79e3fe91cf47fe0fb81b705b8e44498efa75f5890c75101a5dd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410191729248609-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410191729248609-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3340ed520dd29c1459d515ba3c63dc525487d3a2db9f63e7da8bba7ec9be7608
MD5 06630f0edd40cdbda5372f040f0af8df
BLAKE2b-256 dd57444801162634036a15e9ec27cd7388a2ef63dacc2f20398604c25d2dc2d4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410191729248609-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410191729248609-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 124141ae1b0c93482371690d211212b45822c4c3992ff1c9ae90a17a7b224b3a
MD5 3897804f6db370cb98df82a8240ab134
BLAKE2b-256 21fca9cc70fbc1fd076775d1bf449377e688c8a6657fb9fb1c2c27c74cc4bc94

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