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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412131731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f5fbb91a78798291df25ea02100dda0d850f112bbc3f09af0d02e006f235f17b
MD5 8cc9fdf06b36d1e6bdc483e6b3bc3636
BLAKE2b-256 b213848b808d111d636f8903cce5fe0cc5602150efb79249b281b0a4579db6cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412131731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4e6fa2ea9f8de6ac9ccdbdab3c308396cfdf2452f5fc082dbd7390e54a79840f
MD5 d2e6e3ebe85e0d95d8a2ffb42ffe6c1d
BLAKE2b-256 9000a0e1ce921f255ba5fb6f60252d02258c013a31172a4a2a8b9101db8ac10a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412131731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f8c4df492e98d74bcb5637f10bc60a643a022ffbbb30af7a7328428307c57db1
MD5 cc699bddaea9ca4e861d6c5deb119e53
BLAKE2b-256 885f107fd92a54ce3a9d683cce100ddf92742f0d6693aaac752bdf37d9f5e996

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412131731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3ed470bd900d225b0d2b9726d44fceede472321236c9a8158abd32698f0e631a
MD5 bfe5ed817224e14afa66a7838068f117
BLAKE2b-256 bc77300aeb4d346c5057344be8281de0a64649cde6d21e9964711499383386c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412131731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 0e25d07b35acaf7226eaf8c8fa96dccd672fb34180d49b4f948d79cd69c90069
MD5 f909c1a9dfd88f3f0420c1ffee4e9b60
BLAKE2b-256 4191259bb4abb446ebddd773a04a338b9621b4795d06695b719ad87ee6a68c7d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412131731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ecac7f64ba8a11975821e0f36379504b036ffd903ba39452b58cb6af00e0fd2a
MD5 32dfd565ef9ec21ac31ac340095d393c
BLAKE2b-256 c4c9b21ba9580abbb7a132a58601c7cf528330c322af79306d2bb58b59aa9bac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412131731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fdae88a349f138f343a1a76fbb9e24ec672d14ebcc31450c28dc1a0440cd5a60
MD5 841a68ccfb7a73579fc0bf4dc8c28bf7
BLAKE2b-256 b096ce246ae23d83329f44b69156bf75ac14bb119fa840db726cc7ac9f4df8d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412131731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 eb4b9f472db744692f3746483390f0e1cb74073aa803c18661cafa426175c7fa
MD5 e956a445e785198631dba7ec9d1dee82
BLAKE2b-256 0ac33e45b6b5aa97cf659390c326851e2ea2af986d8739f360f193627f9f7a13

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412131731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6d02881436693341bd100e49081d083c6f64d49f0d6e3d9a7b71fe884bbc39e3
MD5 28d573e96a5ae5cae31b16c81f567abe
BLAKE2b-256 4ced4b0f4377b17250445e4163b3b76ef11c965bb91046a8ca50b09e830472cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412131731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a41f61ce22884b95b4a4cc83d7aff8dff8e3dce4b0827d47b8e9d268d58cd5cf
MD5 fb13e5dde32346b4e22ba093e602f2a2
BLAKE2b-256 b32f32b535fb53cc872041b97d2723addd01db709c215ea56f8cd3f4d7eb2da1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412131731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 6268c0de72d6604d6c42f17ca0bccc1ca8b3cecd8bf814db96dfd11c3366086d
MD5 3941cab8c19cba35de71f76106c69ce1
BLAKE2b-256 79bcb111ff4568f2344588d40ce8c2e097355d3d240792f467765e6fb400faf5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412131731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4d752db0ca5c1d1f7e5d96487df585772f1f6e3436a714822d09ef76154fed98
MD5 a6bc4eb4bfca27c14b6570438fe8fd93
BLAKE2b-256 f11a50257ea8105a90757847b5c007e00e8da244cc1bae8813b94524b741cd81

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412131731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3b4a75fa40d5604ba45eaf2f0426a5e645f0248fc38ba6a7dc5c96b1becca425
MD5 2d740b97b8451967397a8cfd94b46477
BLAKE2b-256 d22204882546193ef9fb6efae81f0b22e6b8bd7099c85c948e4893fc1c2d1d2b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412131731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a05da037c62267329901add976830d61ad161bf01f2efe2f7ed4e3d10e7db474
MD5 6dbdd82b7ac6d0b6d4e684e451ac3b13
BLAKE2b-256 65f2a9e0478fefdf72eacb8aa6d1a519e07a9cbbb65dae5df37142420a3470d0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412131731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 12f75d001713698dac2683cab5103dc3dd135525d132abf03bf35759d72ffdce
MD5 c5cecf0af7dc2f1f83c1a0e9714a150e
BLAKE2b-256 617f157a37a642d113db098483e28c98f60e3cc00cde77506c8641124f4c27bd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412131731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b5737c74ad260c0b9ce56c80c2d22602f9124f4a09dd366abdf08348fd8fcd11
MD5 10d05c93a7f9d29a3ed2a1e798b2ca91
BLAKE2b-256 31b55bdba9e58b5ded2704e89923519aa23f7be81ef1405616796f7b9173afe7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412131731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b459fedcc23480d49f03758d2ce5758a2b239dbd2fec7b71683d4dc3b4d0dd07
MD5 cfb215704cbccf4007fd7ff58592b98f
BLAKE2b-256 2bfc87481da1bf5b09643992c5f35f0970f4a454095a9a38df151ab308270814

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412131731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 88c60120df193686c1b4e61d8831ef6a148f9458ff592bb87ec9a2be0d4b2f58
MD5 7cf906a0b4551bde61226c0011322554
BLAKE2b-256 96ddaea03e56b478ebb32dfd13ebf53e3312c6e2d2f8ac023b94ff9c70d102e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412131731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6223d7ce266e70218e4c28227a31c16104b16429d8978cd3fffea68ba30867b2
MD5 c77778748b9cbbdb1882ab7e596aa651
BLAKE2b-256 00d4724b480652591ed57875b58264fb70872cc8624410d2240b759ec9946f6d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412131731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 edb509cb2faac24085991ac30b41c97f7a4fc851f3f53e664fbe8c0f9a2cd2ff
MD5 21ae01daaeb825948c608a65693d97e9
BLAKE2b-256 d65de1ecb887f22c307029a869eb6e185d31a1ecede1950863e525fe69dbf967

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