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

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp313-cp313-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp313-cp313-macosx_10_13_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp312-cp312-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp312-cp312-macosx_10_9_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp311-cp311-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp311-cp311-macosx_10_9_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp310-cp310-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp310-cp310-macosx_10_13_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.10macOS 10.13+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 93993bdd6396bfbf582c288ec53659a932dea79b39228be631cc3a9ac19093bb
MD5 cec2115f79b6869627068c15fecad0a9
BLAKE2b-256 ff0af1cde2deb34d7c0f4d7493b26b0a59420d54b7910ee9b328a9dd2cf0b54d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cf96f1b10c85594e10bff95fa2b3c478614a3838cba8cd504086a07a7c75c610
MD5 dc7e7e48a3e0552947e0134185460dde
BLAKE2b-256 d8f5a13f906f8685441400a7a553101e5d5861dd7443b13291d2b15cfbff8cc4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e257264fd6ad06db5af87d22849f6b7edc8b9ea6cb49f2d3bdd37e0fb230de91
MD5 40ce829dc710cef1ad3f1099d463d7c3
BLAKE2b-256 498b61d122df1891ff7c5ac620b744cef252e17bfa69db676e7e69884c169b9c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3f71d4fde91328adf77b07127c290cec507f268c7968cac1f6e3f0b804b4ca90
MD5 9883b5c3f5b8f7377be44429699a4d02
BLAKE2b-256 4cd094f11ed2ebb70a94208e48c63c59392328e6c7db2be367018edfaaa51300

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 2bd7a51c061828245582aaa934f099ec8f41877b4c844ff0d25cbfeaaece5aaf
MD5 9e542bd149a6187bcb430a0edffacf62
BLAKE2b-256 8a487c1abfc1dd3e917952ea2ecfe6502aa268578a614bfb76eadccd8d3699c2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b98109e7804c54551a805a3ed9120d37758e564eff2ec92c6725b265e4959b28
MD5 c02c617bdc4b6d567e3526a27ce21eaa
BLAKE2b-256 26aaef6b31e73a25ef3f4c1d6d441af800443c91eb2b71b01fa5e448c2fdb160

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4f85770577ec438faca814256d6358257845508e3728a7908f210c093726adbd
MD5 5b4e3686e430cc297b32780a33e8a009
BLAKE2b-256 6d6401ff2e0ce9a7bfff80318d9c4694f4d0c302bab37e1eb8dfe2a7807b5484

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 48dc175f087a557e9a048bae878811754f4abb7e815b6caee16d95dfa09e7e22
MD5 3fc8692f09d82388e068271ab132582d
BLAKE2b-256 90fef24d47c7707fc002c981c1bfaaace032e8e8d1a8d5dca8d969bf676321cf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d4efdbfffedc7b92824922b2bd69c1f265779b65f849088811d153d85f03146d
MD5 8970b9187763cc5e3f40c4e066870fa8
BLAKE2b-256 3acecb1570c76141e43c5b0733b603c5deaca680f4651b76390e132f369eea49

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d662db67f6b965825cfa13d27752512033a7a820df41e4c8173d00e1017e7601
MD5 307196873efc352847e722429f2a4bfe
BLAKE2b-256 570a77c549de8a7e8b78d2e9175709b733198df0c40d8a024a85284d9ed9d9b8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b2cfd2660b30bbaa5e51d435fdfb31a83e7e8d58ccc609df4878592099a313b1
MD5 fe09697e9c44ed8c66080586329408d2
BLAKE2b-256 6a903acabbd04adbf98e0afc54117b0772ca7ad7d86422d9effff4ac1cf1e7b7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 97e540c157228b1a761a5bd21c5b255917433c1145d8643ae067e9441f0405a8
MD5 2d6ef764b92776a5316f981ac93bd66b
BLAKE2b-256 0e25c799d4b661cb7e9fe1d3c950fbeda78ae3d602a5c21e97a300bef0f9a9c2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 864b4db9d130c9d9e1e04af85923e066e8a75bd2bcfd69d514adffc6a9e746f4
MD5 c1a5892e07da8bf12e3907e98660c158
BLAKE2b-256 caf5d0744a3a91ee62ff75ed255b4da97d61108c69a4134a6997e98b488fd6fd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d907d9f8de7dbfbe9ea06decf1b605cdb5c618038aa933e8f5f65066f2f50aaa
MD5 d4146b570263310f3132d047e9cc0df4
BLAKE2b-256 6a919923766643a60f45c3dfba00ea94667b3c1ac0da4e72138a73ebedd9e6e2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d9248442452cdc4d14c07fb315f3ddc26dbb9e969717d2a1940a207cf7388016
MD5 b14127164cfe4190117f8cdc175865d3
BLAKE2b-256 da803433b166316645059bcb079fe3f5a0b84e7f8ce1c2c100753869ba85cd25

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 3d8ceb796cdec38e838171eefa5a65b6a0b125fdfd7ab581eb667b5a343bb7c1
MD5 f555596d964520478973ccb92ec9c9c7
BLAKE2b-256 98f3ae69d37cf700190ab604a7456ed0dd88542903994330fb283a44bb0ad8c1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e7c559c3e05f57ce5d3b9704cb42c27006a04adba249fcefcaabb09964c14afd
MD5 1fa6a3c420d45d2e2956985b379caa20
BLAKE2b-256 ce11da085361d9b7b2ddb418c3374f683c3a5675597fb9e60470550542771031

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 202a7688b96cba68448bea570350b2896c427e03aeee022006b797ee52422091
MD5 e349bfe862e17c74537f67b3ee2e6775
BLAKE2b-256 7ac3cc22edd6a80302ea3edfad512644e01fa1de7ce14642a5b53bbc31ec9fec

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 78ab1cbbf05dfc560f62df19e3447429c61c55be3d4faa56202b7121cbbd7cb2
MD5 6fa9e325192c235d0eb467e0bfa66242
BLAKE2b-256 b8102ec048cf5a50f4634213df9a30a836dc5d4301287ac81dfa778c772858a6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp310-cp310-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503191739452835-cp310-cp310-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 0972d4562beca221f20f891e47d9be9732d3390fe9981afe503fa86a74ce084f
MD5 feb41c34b1dd1ee1e169a6de68b67676
BLAKE2b-256 65cb747ed2a438b1c83b2e97ef287924893e1773435d53e50b9b4b370a24733f

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