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,2023 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

pyAgrum_nightly-1.13.1.dev202405071713370971-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.13.1.dev202405071713370971-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.1.dev202405071713370971-cp312-cp312-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pyAgrum_nightly-1.13.1.dev202405071713370971-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.13.1.dev202405071713370971-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.1.dev202405071713370971-cp311-cp311-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pyAgrum_nightly-1.13.1.dev202405071713370971-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.13.1.dev202405071713370971-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.1.dev202405071713370971-cp310-cp310-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pyAgrum_nightly-1.13.1.dev202405071713370971-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.13.1.dev202405071713370971-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.1.dev202405071713370971-cp39-cp39-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pyAgrum_nightly-1.13.1.dev202405071713370971-cp38-cp38-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.13.1.dev202405071713370971-cp38-cp38-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.1.dev202405071713370971-cp38-cp38-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405071713370971-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405071713370971-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 fac4f7893932b8d13dc1648abbdfe9a66f5bf4cf997740c718b1821308f64666
MD5 fe102f9c99f91234d820cc8f37ff4f41
BLAKE2b-256 cf6de5e5e7bcae2132f267acb6a2c819a6e6f1563d3e5b6c5e24d763b3e2df2c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405071713370971-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405071713370971-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 149e3804186d65ad6c86f30e714cba40071e0c23d9584a3b6e64a9584dabf755
MD5 82cfafa13879741b17a1b635faccaaf1
BLAKE2b-256 f508f45c10ce307151b98ee3b666beef38a9d495b27c9887574ee091b98bcbb0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405071713370971-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405071713370971-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 361e636f44d60773de59f7f5a2b631583d191b2ccee093d6e479fff48cd58039
MD5 150454b150c1b680e2c9e73f1bad6001
BLAKE2b-256 5ef5cb69c5f852bca2cf6bab0d90882d16952e1502376962f409074a711ab9a9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405071713370971-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405071713370971-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 22582e957a1a5ef42e9ed91bb3ec9d7305efba53013d1564784eb0a8a5c5fe27
MD5 a0260b4a57a3007faeb2ec3914ec0b02
BLAKE2b-256 b5588c41d499d432a93cdbccd570a53c86edc01501f6eb274788c7f84b532fc8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405071713370971-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405071713370971-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 32eb464cc551f1f18883cd5b186a2289471c6e2308ce6bdce711d3d7ee21c0c9
MD5 579db6ed0c9522d748017fa8bfd98d58
BLAKE2b-256 7950f2d28c22b69b0c798088461e96b257ad685e284193a6d0686a039aeaa81c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405071713370971-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405071713370971-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 54961d87a1774b7d3d98df13f8f90e28decd485f1ffab0853032d4a13ae809a2
MD5 554d7cfd042eb25b336bd72135975a5e
BLAKE2b-256 7a4e283765f9f86cba90e1e18725f5d9eaa12a788b2dfe3fadced02b30ef0b5b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405071713370971-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405071713370971-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3485830e3255e278a0ced3b2378b68b1829faca8bb4b7ecab91a79395f3ef692
MD5 55fee216f669d5cfdcf4646dfcf37ec0
BLAKE2b-256 a01ad29598a80c4ebd566aef3486b9f1f09eb49affc66788bdefa7413d8a643e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405071713370971-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405071713370971-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5afdeec155c792282684c0c0e686f85a5a662977abf447a95300a833aeb6e031
MD5 665baf9870ba05b600efa070c2dcfa12
BLAKE2b-256 cede349e152e84e0bf52c9926f0412af9700f7211110c4ed4e88378bfee22f69

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405071713370971-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405071713370971-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 341f8e5d1dc3fd776cab024393647c81aa4455b561b7212a3ff40ea75d41154a
MD5 b1be6f4c2b635ee94c7de97e24004e99
BLAKE2b-256 9d15f1beef0e0e3771744c4abc511b8b7a0dd1ff5c09dcf5b581f3dfb3b55f6f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405071713370971-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405071713370971-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c38d9c153533042bac3f6ee0624db608770168aba7bff989f56bc0037ac51d93
MD5 a5e4a17668c1f0f7f68e5f4fb7ff847f
BLAKE2b-256 7dc8174c20d2bbef5103b0ab909721461b4bc9b0799c2982ea33b7b1cfee974b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405071713370971-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405071713370971-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e09638171eeed6f701b7a90deaa4f9c4fe05942f4ca197192b2a5243c0eedffc
MD5 a7037fb98ddafadd7ff31f937f93a4eb
BLAKE2b-256 6a68047fa41f3a7ea61c42e736b23e3ce16a36506fa2451977e7fe9f28442b04

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405071713370971-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405071713370971-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 539d8fcaa660d48609b530a6be98d6ac4ecd5c3fbe21294b542778121aa5971e
MD5 e61c7fe28b75f2d898cb320ad1d54a96
BLAKE2b-256 1f17dffdaf93151691735447010db3075f7bded29f580eaccbbf3f64f5093320

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405071713370971-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405071713370971-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 cc4aa87db0ca6c27b6a7764446ed74b45d71753626e990a183612540a9b473d8
MD5 622df1399f36b4fcb7f7eb5e1cb97dc6
BLAKE2b-256 5fbce72117d2c004cc1496fd3df6fff96a60e188e9c37b88d1e74b5ca03b0674

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405071713370971-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405071713370971-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3d74682e94239b9615d08a4f7a525c0fc6fd9ea8698dc4159527ef225ebc17aa
MD5 3b7f142d90bd9593e9a3fba03e1b3c68
BLAKE2b-256 49d21e7c8d8eb94e4caf74debcccf22c93430fbec36da517d54cc66bde2f4627

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405071713370971-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405071713370971-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9466d17b52ed3156d64963e906ec90eb851ffc515e7bfb42ffdc8a66c810d464
MD5 53680e80931b92b9663659157a73551a
BLAKE2b-256 ff0adafd3ff591bf4462172feabcd5aa4d86d5f9fe629df150b271c72afb737a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405071713370971-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405071713370971-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f46bcbb4680d1cb864bb696e851b456fd17276eef28f8040f0ffdeb1e46f6df3
MD5 cc84c0e95c771e74b3c6d2076e54a4be
BLAKE2b-256 663bdcd88c4e5e86da3e860c9f0fd61e62f60070d59dd6de70adae03fb68f30c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405071713370971-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405071713370971-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ed86cabeb6eabfdd7f14cf8adaedba945294523f420a745115dba83555dbd711
MD5 d0f58bda49297039890407f433b1cd88
BLAKE2b-256 9006b77be36e88278e891cf161e2b7088c957b9ea970da44fc4034a3895a6ef7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405071713370971-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405071713370971-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 475110649ff3a38b6d438e3f693d0f88046d31b0c7e1fd56ce4e7bab76c037cf
MD5 2deb04e5a6758c4c9861d8e83d3bb0fb
BLAKE2b-256 0f34c839696d301abc17625d8368cdd8896b5b3bd364d2a107ec92515df4ac46

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405071713370971-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405071713370971-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3c8e57f767f3ebc100a6be7e9f7f629aa78247c75eff15a643c015d83fdd7e7b
MD5 dfe2f3384029006fbbf5f859c44d38cb
BLAKE2b-256 e7840cf4318f4c99ccd428896c204ae5b8f1be0ad6575fbea57455caeabdc677

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405071713370971-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405071713370971-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7e0296ef5656e8ce6aa0d9b4d706f2d77566bb2e990fe400c2cf7973e81fea43
MD5 7e2197b0e1044214d5bd93779538025e
BLAKE2b-256 465ed6088af77bb4efab6a1b3f2a615053b96a900902393a3ece2c8c9259612e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405071713370971-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405071713370971-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 5c964f0f66c28bbb2884c6245a50fc47582653939c119e8debc10b74bbd2a741
MD5 169ed016e5c0074399d53250d61eef53
BLAKE2b-256 6c67d45b9b3102fd7acba5258931fb7f636ec6271b5784c5a438946fabdce0e7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405071713370971-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405071713370971-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 eba2b4056f92639c8a8244345f64055c0ee8e32368867ab2a62704ecf5acd144
MD5 64c931f85b5271dea20b5d792735785e
BLAKE2b-256 951f0b95ac4cab72397488f632d145f0db17fb4bc0499718a391120bd3e71f3a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405071713370971-cp38-cp38-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405071713370971-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 07485536e051681c4cb6a495106eaf046d8043b12952227d022315e8066a03b7
MD5 2914a3ba6d7ce46c14a0c359239c4efd
BLAKE2b-256 8253e7e4e1a6b82751a6cf5f86b74c8728ca9cdbda6ed6dc636aff8b19ff986a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405071713370971-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405071713370971-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f6a5c4abefaca4cdee017b49bcd78fd7695a1c917f18f3a0e5e46d6f987e4506
MD5 9fd8fcc12b10cc191ceade6bde35fc33
BLAKE2b-256 1e1972d5af6357719246b2cc974979986de980d3cdfb7f66dc3af3500bd22a69

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405071713370971-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405071713370971-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e525c88dd33abfef8c0366e31eba645c37a9b7808dd7115f005fddc1372931ee
MD5 83ee9719501a8b7c74504806906f76dd
BLAKE2b-256 78c680f97e2719052b1f6e037df288b21673154461f2785e776b098f6156e7dd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page