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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501171731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 88fdda8a3e49ae8ab614185276c153300c42982645e06dcff6eef7014961002f
MD5 b976ebabbb93a6c0c8c77a0d12e3b5ff
BLAKE2b-256 7a9ea72cc35266fce88d0ec922df0b3e5f1624f191fb661f205899e5e139cb5b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501171731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5ad9a1dd4e17f39c0df3ee0e27010664059e5f8d910d14870e0c56fb2c10e782
MD5 f21a7056587f4154ecc53eef2c4bfa44
BLAKE2b-256 0f9ad2cd32bb4990ecc10ba9b5c7d8c716e35d991fa2a1aeb5e79e4ba0a9bcf7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501171731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ca814da218e329560aed278498a526163b04e1c882d153930415f7223fc94763
MD5 ec20031de1c91d615530a0f6292188f2
BLAKE2b-256 a9e43764886df390b15f465133ddc887d3708f9993b2abedd2c75e944280be8a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501171731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 92645ba3e473736f49caceac19933fe3f36ea2b9779681a30773466ff065da41
MD5 84418deb51c4f89e7ccd42658f7809a5
BLAKE2b-256 83e1fb0568ac77db1f92fe57bd1d7c61a138eed84bd63242998a90536b62b8a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501171731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 0e373c83ae89bfccb6364e1c2a15f906ab2e0a0c44c7880ee44100276fb77243
MD5 59a0ea3b5a8a3ec61c5506ad6bf872b9
BLAKE2b-256 a451eda6e20e6b48f0a806df9eeb722343c963be9172aab3f5c9871e2de34a27

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501171731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4ec3ce23d76fe4a72987913c1847496795ce1b0105633615a60b3478872153c8
MD5 2445a2e6943a3555e4874fb6835aad79
BLAKE2b-256 7669aac5a14ff64264a9403ab50296c629cecd00d14be8d4ee194570baa6b6f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501171731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ffc7cc6d896c383a5ed05421c823ad7c1efc49bb7f361e396f236e0365d5d71f
MD5 3940e5ed249c13978bc37d923555d839
BLAKE2b-256 1dcfcee2b1f0e9630694a682cffdd267c817533e4dfc42adfca8c6b374b88c56

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501171731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6394c08922acfc9eebab46677090b67a6a3a33c9a48c1ca67280447284988a8c
MD5 186aa7231cab35b3baed35e10f2caee4
BLAKE2b-256 d11742082300878b8993e9c707d0cf6adb200eceffbca5e901cd15982c5aef42

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501171731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1bea0c525801c2aeca1e64cb51ad274f47165e3e4724455e2f62bf271c55a12b
MD5 fb54e26afebd9647b82c330373af1bb1
BLAKE2b-256 38398b5f7953fc34127051ead261d618f54a8e9cfa1fc5969d070364dadc8985

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501171731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5fff8cae07baf9d253864fbac277e780d9d94f1abb38e4168d0ecbb9988bf9b6
MD5 047d4ffc621a28aba651a26d1486a624
BLAKE2b-256 c3cd8ac751a8865b931baa9b1d67125ab1458530774883782cca6986e1de4127

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501171731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a4259c1ec60787f213e933a0290a363fadc4763c8af51a644d3734969adcb15d
MD5 ec581c038a7e93f1af04c87eb709867a
BLAKE2b-256 96010c246bd5b40954a5e83b3c5cd3267cb38ea3be226603e7cf19f5d4f66136

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501171731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c6954d2b95eb423e170382915d9ff77cf56ece0323423a1028afae0e6efa6de8
MD5 8291503fa316620dd4bec440633653ff
BLAKE2b-256 081c848d6c0339d06ed5b658f6259bb2431e596afbe1d27906c926f0a8fd4e8a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501171731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 033b793a89e32e1196f8535db3a4d581e7c65c6c5b875d35072ce155b2dc7c8c
MD5 6bf392d10116d6b920518c9cc7a6ea24
BLAKE2b-256 89510ecdfab0c7b9905c22b23ed3acbd82a0d67312f2415ccd9140d7e230b992

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501171731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d08aeb1062b0d519e915be90d3c13eaf1c0a1d73db60017b1bb7b4ccee3c938b
MD5 9297cae93b361bfb38c530f78f5a4b7c
BLAKE2b-256 7d9df9b2a08d926f8bf925493789f6e06d63938264742309d2018edb68549d14

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501171731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1f8bbe982d1778bd0767bb7b016617ae72b91a1fc7fc34ef5f59dd5e69f94696
MD5 90a5940d665f1e122ecd2d88b4d7d5d7
BLAKE2b-256 63b5b6e38cb08c20519fe92ee45d9a2a3b752dd14daf372abc3834939ad84eb2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501171731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7867bd1bc6c051fd1588c46b7b419742c119f8bec0315200d2a0489432ad9930
MD5 d5e578ce60dd3e4f00a4d4f8e410e306
BLAKE2b-256 f5427f4bcf9cebc1a06920f03af87c11daadaf4c669a158009b08b542cf161d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501171731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e98e44d192b1e67c3f4eac3e25351364089b56d50507bbffc535fede51d75ba3
MD5 3b91918f61c3769fbbdbd2b64d87cec2
BLAKE2b-256 186425d62c64e9a068c009809bfe4075426293379c1dd2b60bf95909d2fe18e4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501171731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a6ccaf5917aa4569a5d9abe7a56455b5cefdb6662be7144afbfd6dcddabb6784
MD5 92e9ddd1e9d19367412936577d76e5b5
BLAKE2b-256 dbb52ea5d3d0b77c204d5ee78890303308ff2613fe3b3b9f0d5ba401fea9bccf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501171731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 771bbfae160c9034cda8011fb236dff30dc50303b50e866b1ae4db734f981b53
MD5 720a54f6007d5eb604af6717e4ffc604
BLAKE2b-256 4f07e6906e95aa36a9a89a63447526e4932824e69d6d8d2586ed6a1311f3f93e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501171731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2a1ac2a3b2ce10e51f69b341b491cabe6de59088e5ac8d7d58c15e5a8b4613d4
MD5 2f383117621b72dd76a51637f42fd2f5
BLAKE2b-256 734e4104925d3604e8de798e27f66b3ff3a1168294fcc19be06d64fde5986875

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