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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501281731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8f764f8ecb9773621c24df91e7b5f4a132d3d56e4f89075b6c107f5079073cfe
MD5 4e7b265b1483259fea636dbeac858613
BLAKE2b-256 b45a726882d986d7dfb7410242535603fac149f788bc0a291c463292392e0038

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501281731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ae908b36cc1ca9beb9b046ad02f50bfcff8556d481df418ffdd81ae2461c05a4
MD5 40fc977f29118a4d4e8b8fee9d653aca
BLAKE2b-256 078a80ecf9e2a7d9573e5e4dae0ca662d3dc8b08d1bfcfb2f1f1586848097be1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501281731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d88f0ecc3c836aadf644971d4e4a0cd1b76f3336b0360806046631facef9852d
MD5 0068d8f9554c41517200fdd6cfc4e562
BLAKE2b-256 4f91fb69653f06e0fa79d3d32e3cbc895b64c103056a398cf7f98f15588985db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501281731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ef7727a031048082e1e8cd1fe0d272c09541a5b4d1e992376e885f5d19197420
MD5 15975d9f57eb278f700813a266cc30a8
BLAKE2b-256 f84564131d15f0591cf0e704b5cda46a1307f9913fece262683c729449307525

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501281731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 62b6d1321041c35e72ac056d373d4c40350b31173f5adf18a5bf0360f00283be
MD5 d4d08e6db041dcac49c6a25ab7dc5b37
BLAKE2b-256 b9a12eefe824598d681b30ffefb389a01f7a92caf3590c9b00490f783639268c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501281731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e2a49e479c53c56df7f24dbdbae4b76baf1a68f7f549d24b6cb65bda446f1d58
MD5 c7656514431b69ab7fd13ba2aee54e15
BLAKE2b-256 874ff302d8927c7b3ac2c99eb8ab329c3b57128a1a73c96e2fdcd367dae59b49

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501281731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 833ffe4485343e0278868df1cf9e5907335761ed5853f6b475933da1aede6eb7
MD5 36bb906ad0890c66dae040141dc9e8ba
BLAKE2b-256 ffca159bc2254bbf651d6b127a57883e91f58625b831fc269a086d2801c5dc97

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501281731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8d691023ed1e037608e736e6245596b81b0be56d6cb0d0675f904f23d369c5d0
MD5 7b814c9cdc7abb419a9c6370dd4b6799
BLAKE2b-256 ce083715ff5139cfabff37fbc8a8396f9951a6952c45537266e875c48b8c04c8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501281731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ea73f14b3b7c23ab60717011d2599fd342838bd5042daad7a907de6fa5f918a9
MD5 4ff4d1c4d82c9338805a17d076f2fd48
BLAKE2b-256 298d12140cb23e8851273a4d1a53743e85e669fbd6ea9e2752cefc5c8a483292

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501281731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e662905f4397340a49365d042215cc8a5ededa248005dd8cc7ba4870ee2ad1aa
MD5 823d1b518ac08baf29b86c3251673b11
BLAKE2b-256 d7fe810aba1dd28f6f0018db7c5f97b694a81c25a32deade275e14cc21c5f26f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501281731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e0a88134b791cf13ce686638a405e7f76ada2764c1c78e7946ce19db46b0b334
MD5 bbaafda413c9663935e5b424834950e1
BLAKE2b-256 1140214d2a4a259ad3d6d46c939ebbad3a45f851c9b250647aae0a144c57b1ac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501281731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 62ec3fc4eda622fa23f42c13e7492c80d0f1f6b5624ab9a73950d7bc1de09764
MD5 1f579a9c3a3cee60112bffed7719df65
BLAKE2b-256 c8f71bd4fe75936083c30accb894cb6e9b59c06cffa3bc350ff5edf08a8d6ff3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501281731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e99e8aee1f0a5e3cb741e70923dd45848bf3c41377fd14c118b8c842ccf0800f
MD5 18cbf34e8f1a8ed5874cfe981b885d06
BLAKE2b-256 e16df5340d884d716b10b6e5a0abf58d18a6ec1153ec9c123ec6af17db2deed2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501281731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bd750cd8d19da5c45028bdaf21864c8b44e4152d22e15d66220ea8bde1c28a1d
MD5 94bcd9ee87631659b8f5d805e81565ba
BLAKE2b-256 0ec8ecac2f53750f56d75654bceff6bde74a1f3b2ed253a26efa78fe5f1d7454

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501281731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 fdf8c05658d05d5c8ada261cacf27a0364821642443031f84da86c5dc9ca93b7
MD5 850f6f5afae9a8133bacdd1b1c5131fa
BLAKE2b-256 4168065e08512a6599860474b9ca21eecf6d9679c004dd4116ed761f31fe12f7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501281731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c884a774f9d5820b7ef58ea8fdfe37263b89731bd85868de7430c7caa0d89cf3
MD5 9944b97bb07335346aa4edbb66d9867d
BLAKE2b-256 357b420a34a6a9db29fc68f9a7eaef325454b9ee10cab134d56f12151e575c72

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501281731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f27d287bb8a926a8bd0234789f8b382cf9b00aae11d77950e4c05a42b4debde7
MD5 8d4a46dc27097cb3ff5664526ad741ba
BLAKE2b-256 811d0c81879e2186c2ad3612b49b1245e4a1b0410a26fe1fb8b248f9a7dafaba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501281731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0265811014917d9298a6bbec8e7a571bd9aa6a5c9f7476687156444f4d34b3be
MD5 2dd36c59dc6775c2fdc67c13b112ec4e
BLAKE2b-256 afa61442c925405ee3ffbcd02edfc73a9bd039520714b9f26541066c2658e6b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501281731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 77f72939cd92d41a99ab61f9d5296c32690c093cb746102bdca445f7dc85fea5
MD5 46771d59e346cf9be3cdea5b6e34ae3e
BLAKE2b-256 67bc8458130051a2c3126f0373225713415d5b9f963f57e8940c68a1d6031bee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501281731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7a062e5b3cda96cfc3cf0238dbeef549b2069bef9936bd9c840dd5720fb27b6d
MD5 703802096a848b19c73c974f1982d2a2
BLAKE2b-256 ece946af79363112457e825821916f21dceb7cd692dde171b1b20b8502b09689

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