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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412181731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 85eb69159aac219d8e04b8506db744b0caddf1198641810ef7a5d7eaf51052c9
MD5 b1733957b24dfc1d73dbb9c83fb34df3
BLAKE2b-256 c8d736f7120baf7292e1713e0368d6219a32dda116874daadf337d795aac2ff3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412181731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f60aff2a1829c29a72f8047f1343b394fa48176674c26a3807b1d0acedfadadd
MD5 6fa6ab7574c274015dcd1b43065b44ff
BLAKE2b-256 07b55ad025ec55514ddf21ba6d29b6095b00fc589af49b6a390f1e346b9f5ebf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412181731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d8bca14bef97a26947ab25752e68fe9416c6072505003bd8c03aad79fb0a1b65
MD5 738d720d430f5ad258e0a030f8026741
BLAKE2b-256 61fd895fefb18a8d744b6108d7a6b9566f82d5be6ebb4af7ac34edd1202a1607

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412181731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ef7cfc1737ffe867ac729eca4a97beec6e17393c57af5fd983f22eddc7408ccc
MD5 6ac0caa152ee6e464d9b4d935f2ceffb
BLAKE2b-256 5c3ab4f06d6bff9c263f7ac4619b76925f87323f7331be65b6e9da77fb2e8063

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412181731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 996ef20b6f0d4980381a33414073691e3876616c9b021c64ba6a9940b400b8ae
MD5 68ee1840c09d94a950c5a67b778978c6
BLAKE2b-256 b783cc2ca9c98e0b2d5c6211b2d1235342004d191567c0f4b3fc5ed0f924332c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412181731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3cdf58fa09a78dc44d6d1ec50e4bb0547bc65455367591933fb45ed2594d3ece
MD5 c7eb9c98276c2eb2a61faad9473b7f14
BLAKE2b-256 152a5c085791cf3e62a2f636888e05605de3538a2658b916b243e6e177577672

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412181731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d012a49bfb1f859f64dcc306fa53bfa6b0f22813a2eabd066ceb9b8e36f9e6b4
MD5 81e20770214068a30880ca4381774b18
BLAKE2b-256 48ca7c37fc8ae90af6fbb919fc1b1f9c606fd42f331a78b03efa27329ffe3995

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412181731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4f740805d658ed7000e98a6999d49ad7c9957fd322cdf95801f8b2dd63a439b2
MD5 65aed0a0598832f4d3617fca3afe481c
BLAKE2b-256 364ce21ed12e65b01a613d3e27e7c330f30ee73f68c468060f3207bb046460c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412181731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8ce2101e435ff0297f087f2a43e3bd842de19ba2ef02ed238ed11db9b90aa39c
MD5 5f218a21afa14f833f4605f6eace0bb1
BLAKE2b-256 c61339c71ca69a69c204e3da3c3fda046b1e4f2f7365a476637f1c075134fcf7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412181731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2a97c97082639893dcf9c55c124a69163cb78685e4cb403885805f031e986ceb
MD5 1d980c57f9b21de2d718adca445f681d
BLAKE2b-256 3b4d087a798e68e3c66f1db4dc41343cf65a08536dfedfd1aef8f6077aad1fae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412181731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f3aeaef9aef080266d6ba8883eef71a261c9770f7a2a26f5b2bd5b08357253b2
MD5 4edc74443593eeb4b8d4fc720d549769
BLAKE2b-256 e9a50ccb1fafaa79a35dcb80c30cbb55b4e00a793bef354f2fb85f153ae41424

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412181731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 571fca7a7fef824da31f7c838e1741a1760b8fd70236dd8131d9a27c576cbe1e
MD5 1c61f821b5801cf03d3e3f3497f66aba
BLAKE2b-256 fd1b337f01c9d51859ef3f89752b286742b544a5259bcf3649f172c7d545de3c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412181731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1b647cdc194d4e18cd7171edf55ba17e7f1f51bdfe8492a30d663bacca354845
MD5 33509599640591fa584e63bbc9e997d8
BLAKE2b-256 396fe5200a268793950c555f68af1b3d7f1f593a2e314a170fd7f632ffaa44d8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412181731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b95f824b38daabf5e1f69fe9691a55a5070525b278711122290a60ce8bb283d9
MD5 1d68911d2ead8fc27aefb22e65a6a4c8
BLAKE2b-256 3bc7ffb2a1acfb1f15ecfdde2f52d66866a12fb9b54ca86032c7e8b0f86610a4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412181731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a9cb7390f022942704803e610a30bb27029dd3aef8be17f0b7fede0e67747eb7
MD5 1c1f8083ba845d234bf6f9d0516bdbf5
BLAKE2b-256 f59f53778aefdae641de544437fcf99b1a7728f9f74c1c893597472c6103fa97

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412181731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 715995504629ffd069ac679d1bf592414b2973e7275afd5988289df83c337d93
MD5 e3649f49948da7f4ba7a8fca00eb8063
BLAKE2b-256 3bc2be230d854fa2da0f5032b2a8b6f82554f05ba72377391d7a8b9175b2b20b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412181731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a37b248ab20a33c9839f3f7d69665e4abdc8ac7ce813719e38a1bbecdf4cd047
MD5 76da9b78b579733b9a637a1a2ece2a93
BLAKE2b-256 35e8d98179021185dbe09edb7063df7cb7b3cb235bac4b281a5c7709ff671992

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412181731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 197134238154bd6b2fd6d4d4456fa2fdd95b066945e49f262a655c4ed28df3e1
MD5 024e27f25fc8670802a79854232dd376
BLAKE2b-256 5aa119be54bd18a79e403b2a68a38c02dae3d8d6e62edf7b5aadc3be57ba369d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412181731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 90299c21d0bb9afb03289c74417b1706bbf96d25b2f5736d9c490e84071bb487
MD5 dd050d4b10418e102b38afdf70a8a29c
BLAKE2b-256 ccbaab734e12f0fff53314a6c6c842712fae44bed2ff18e5e422aa841022a8f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412181731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5e6b6b206b35e6f0f3b57dba1645f48862483978aa13db3383fa7645a916c068
MD5 b128543a131b560c362026582e123407
BLAKE2b-256 1ddb3eb144f88482947ec28c393892388c0b51e986386c84a7bdec4cf0bc67fc

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