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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412081731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e90c1f289af205f0627de80fddd0dcce6dabfd0304776235b30f8bdbdb8a16e6
MD5 8547d8009a2c615157e5afb857a2c490
BLAKE2b-256 3190d92b00a602bec245dc3efa43c4fe46edcab945f5d0c7ad890b9c57a4042e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412081731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e442122be8a8b49b562a6358433bf21dbd997bc25c12f69bcecb7d8f106db20e
MD5 89d6461cf5c8b57923f9275c240b9385
BLAKE2b-256 42d308bb2a9039c696fd916a446ca8c1c1971d289fd8d6cce4bb2f97ef3b7312

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412081731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 56937c86a42dcb580a2001e9b168d956bafa3ecb5435ca9a10b5bea3c2b2a374
MD5 38153f291bf85aebf0c0b71b66f8360d
BLAKE2b-256 c47aec1fefbaa3494a8ccc77266e9662ed8f834654c4310c303556ed142663fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412081731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0b479529608ecefdee19a12db3725038612db6081bcda3f545b6d5dddab1aa57
MD5 437dc559d2b1f995aac4ec7dfcad178f
BLAKE2b-256 6c7dae29a85e3e7ccea42d45b68862650bf46150e083738660e3c4edd2099533

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412081731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 20fdefd1bdc1de53162787ba46eedb3dc2e9340fb1b931c64d8355517c38988f
MD5 bf10980c37929633f2fce9680258c1f6
BLAKE2b-256 92a94e41d66641d24f0d1da78a08c240d092bbab92a2add557d846914748b13c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412081731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 239e9fe8afa1ac83747235331958de1e4b35dcf255b925e130533d64680959ca
MD5 b119152db81270c288ee8e4466e7be9e
BLAKE2b-256 29148ae1752e2a88ec8751c3524dcd4726eaa299ff94ccc449ac840bbbaa92bf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412081731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 59e23d43412703d292f5448c2d671b5e6fc26008da411384ddb8fd60a7dfd773
MD5 a18c83d55a679e953115231cc564f915
BLAKE2b-256 4c73ee2b8241d80af441d00ac9bc2f25833ab0a3af46ba0d112f1267dd8818b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412081731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b4bd2c3db6f392d30656fed7adf402b34b0fdf518c6b4b9763af958d04d8af67
MD5 b99e731b3f354cc2440283f217ef5da9
BLAKE2b-256 2690e8a05b79e53c5e94097193e8202c58fabbade0abcdf07d440c5dd5e24f2e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412081731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 07de3d6499dfccdd594dd6769d4dfdd788350bee644249c4bdeee7ba71053fa2
MD5 306214331220b5ca76acb22750fc54b2
BLAKE2b-256 e5790d9ef3af65ae141c3b9178396bca3a505edb09f35a4e857485f664ff1113

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412081731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 55f7b731ff18c27ae9cad1150affd9c4649c15bced4e4b5628afbd325a819897
MD5 9573cb1bb54ef3730a422738c6378c5e
BLAKE2b-256 ede9bc1d8d9553f7917ae059fc522686ab8cf76bb3c346aedb17c8306654fc1b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412081731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 ef02c9e34a3ca4cfcaf1f619966f2a9fa6c81d82a0c4ac0deb496cf17e2604cf
MD5 762e0a157588150d61c13a8037e89568
BLAKE2b-256 8749ac18682d41e67aaeff339b75dd26ce55ba781c88038be9f2d9ef5d6e4b44

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412081731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1c022c6be70e514e285b6bbce83727edd292fa776e8b52fd999b11636fb68c13
MD5 9aa798b4ac662848da86edfd43d0eafe
BLAKE2b-256 dbfe373a8f5b4dbd771b7c7d4c073c87c3d19d810aade698c50048a39ea130df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412081731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 da4eff018fe6463850cb6d77d4ecf0d59c30731d5cda4a520ea7ade66fc40d17
MD5 ee74497c35202dc21d3d76accc935a05
BLAKE2b-256 25b50cec956ae570431197fd86acfbd31d772b49389658c9cfe7eba92f1098a4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412081731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a82a040f75296605ba53d8afdb154084f7b1eedfe109d884198df1f2047c61e4
MD5 d3a33b1177f14afe4ba88fb313cff9e8
BLAKE2b-256 ecd5e0fcc2a36971a44e1243ec27ce8d892db6341fa008d749f0ed431543dc99

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412081731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c00aaee5cb816a3ddaea3a432ce694b32c736becc8244b8cf07e19025cb455ac
MD5 9ad24c810bf6c5ea833647ddd689f3d2
BLAKE2b-256 e73e28f6b6a4d490e24adf58a6c0160b31e9c899230c111c89c4c7aef1247f4d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412081731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e370983ea6366644c37c35699362e74b3bba8af890dbeb0f6e36ef89856e0ed8
MD5 43b1c97c375866f6f687171f2eb93ab4
BLAKE2b-256 1b5732632746ae130570e8f768e12efd866f1e96461c3dbc7a198e073166e6fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412081731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fda96872ea19241d8f9b39934d4ad066536d19f2c7962d5f33eb0eee726462df
MD5 a0f892f2fbe5992ccc7b486086ca614e
BLAKE2b-256 ddb30b7df97e76d16d2d96d2215d839daf9f2945bc07f5e81b8f829d70bd39d7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412081731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 64788759e6fbc073807435545253c366b09cc0f1c0977e1ebf02ed97e4e98d81
MD5 5e9a4da5d64f46a73c03108f87b9f7e1
BLAKE2b-256 ed4f4243570aee12c84019bef67323caf08df48bc46998f5d41cf4cf058a4a71

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412081731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2bea28755429d82940a9321edbe3e81867a01810837c03a35e51c2d03be4ca13
MD5 308b335e0fa81d570b41f92b844f7095
BLAKE2b-256 aa766217797c76ae3c524cea6ffcfa0044d826ddb2db86834a84fe6fc94185e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412081731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b71253b18584132a29045ac24d988cc66cd76e73dbc143917c74557ca7f84720
MD5 7004520e4261c2eb0115ce34884f554d
BLAKE2b-256 eadb53f48cbc389318bf69b1d91b4323f2b5b85b34f870147857251ff23177a1

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