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.11.0.9.dev202401111704620238-cp312-cp312-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp312-cp312-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp312-cp312-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp311-cp311-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp311-cp311-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp311-cp311-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp310-cp310-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp310-cp310-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp310-cp310-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp39-cp39-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp39-cp39-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp39-cp39-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp38-cp38-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp38-cp38-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp38-cp38-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 bb0cc080ab1295bfa6db68bf4f4b307b3f9cd13eb0253523164ced61fa294d99
MD5 6ca57b3aa3397461e3bf4268af97c2de
BLAKE2b-256 a0d172a3496cfddcc36fbd22e3b74ff684c6597694c3b85bc84175764421ddf1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 174a42bc262408bf03ccbde809bda8d0b0573388c91a21121c713073b76434b9
MD5 f36d13f2f60e05c8a9430a29aa6abe4f
BLAKE2b-256 9ed5a832b3ac37e66424f86eb1dda5c7c583e3cfe8f4a31d7c63a1066153575a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 138e9728fd62076ddde81111411f4c39cfdf1de03451591dacf1534daa090a33
MD5 32dd705628c3b1b584c65a5fbbf55a3b
BLAKE2b-256 c560463fcd03863e98585658fea7520edf5c7c8963585019650836c23c94efb1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 06a5cd69ece5a3c5fa8bde3f391cabcb3b02ec2199e48625fa31e4fd10712830
MD5 2af1eb27c2889159619e942f0b9fc06b
BLAKE2b-256 7e1611881f9fe0f0c540b6f34b68d9001792bee02f8dd46f93cd681633ddba5f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1557c5260cdb9fb8e21c7f0e2bd88af07af2aeec6f1624e9db5c3031f1e2b965
MD5 1c45a009b097811c58ed410b41fe7761
BLAKE2b-256 7a7beb6cb1639466b68cc2cf91121c1f4dbf897227e7858f4ba8c3422095f60f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 cd054cdc6a8b1fbf097df9ac1873087742268d4918c22e735f22a8dbf5b1b1e8
MD5 3e36f972fbdd546f228f74c7961fa435
BLAKE2b-256 5bf11491b9401cd4e2c5730b0b7e119e266b36bbfd41dd608f63d83271c6e53c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e6df38657783bad4a39dbef5f3281c67a239968413c6918c9c37b0a2c8188f05
MD5 02e8bf324fddd670b0fc66c44a10c440
BLAKE2b-256 ec14d907b742c779cbe114914fcd4928a2c5965deb209f43a1cca4c32400e806

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e4202750b949a7f5667a04867ca712b8dcbf0ba456e99556060beb6bb40aa946
MD5 0ca20937df48c82cc5c6965f081c2ed5
BLAKE2b-256 acd50a24ea5dfb45b4252943750b6bbf8f5f08c4c19c6aa140a9dd539df711e0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 13fee464dc96e1bf4b08f9966595b8f24190f47af39560c1316da0976e0e43bd
MD5 cf625b58f83a6a19c8d5960eba35929c
BLAKE2b-256 2ca38eae287ce2ccb5c88c886bd66c349675ff5afab7d7e6160f3722e9304357

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 adcb7a5724ecda45cc25c30a04919786c5f01f6801e47543da96ac145e1ccdb6
MD5 b471ea77416c32ca17d847aa010446d4
BLAKE2b-256 2354e05604770ad5043b97c5d127b7d65f0261afae37d18f375ac475bde686ee

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e87be0ebf436f927dc22461acb8ce228b568191b77d3bf03e9d32464d30629e8
MD5 703df0d3fe8789f595aab82d524b6e65
BLAKE2b-256 bb4f70a1a8a294d8fe688b465d00a258a2f1dbea529c2114d2a159f12a50ca72

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 424e43e20397018e4c3e38f6495a323ba1ba71ab63e0db99ea383ced6d81f5ee
MD5 048bcbc50f6ba67842da27dbb86e9559
BLAKE2b-256 97feddc43baae53dc15a2e215d940371164f17279b53ed483556069aa42e7a85

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 136d6592f25a76d85fe395c23161474d91cfc8e186fc630c8445e055b55763f4
MD5 5d28a8bc6695fbd5de7f6a1d04574ffb
BLAKE2b-256 e3b800226713cab1759fea9b00e5aff7db448af1573e435faa81ff3913c5f7dd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e93f1689c05793dcb964a7a63cd8fb65720c26df341156a5223f46c722e3a5d1
MD5 634fef90682457cc4473cdd9982a683d
BLAKE2b-256 a34bb68a0722c9165188d718c98654bb17f3458aa05450abc5049bb753833f71

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1dfcd301dacc517a2a3ac969ee1190a365afada0684df9c0ac8b973ab2956b2c
MD5 13451a227ec99167cb6bb2b74e411f8f
BLAKE2b-256 44e269f8c61e95d5b8f4ca6d862340988e04de63e71b468b02540ec834904bd0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 38161c9e4d540f2a9f3dd807fbc63f6acdbe0f11754f228fbf58d489624f30d7
MD5 6626aa6e49a62d93440b302fb332e433
BLAKE2b-256 70f6e68e76353135e0e41b41cfbaef1667222a70f537b15e3ff1e24ae0716b64

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d5f1b24ccab0c20cf38b63dbbec06ae8e17748c0d6f009e935e16199e63c43b0
MD5 b1ec07c3987533943953698afc998640
BLAKE2b-256 aa645966e55e0e8b7cf3be0059bd7f7e827689c4bd4953c53e3647028e436165

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bdca8c7993c0612f74c60c487dafd7c4aad992b07408413c59fb0c508cf8f68f
MD5 334307cffff88d84122016f85f5f08f2
BLAKE2b-256 81fe0461ad0f940906cc8542f14a6aecdf2ff823b9bcb0d5647153bdd5bcd358

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f6514c43adbf5e649ee01bd0188efe85348ca04231e084d050a6bf32b9660ae5
MD5 cec617cc7a312faee5a71fbe4af6af00
BLAKE2b-256 fb4104b475c5765b47976b7c811323f8d28cac197cffd7727d8575e8b2da6c89

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 17abbe34b50b0a77346baad1484e33931bba1a6e414a05d35d35fe10a5103088
MD5 cb6d6bd5481290dfce295645df40de0a
BLAKE2b-256 935169bea76fd6c0ce41def73415f7050a962c2e72db516941edd10e2fa63c94

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 304e9e21fe8c9bf209c7365e7c8e7c0b6593f42ee10227ab167b4fdf2928418b
MD5 1c3ad80cc5247c8ddba42a9bf959c04b
BLAKE2b-256 746c2f717199236ab6cf1a9e088edc98030b6b9441c10ca3898704e78b024bca

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 82c98ee453b40ed1f3057248d332985cbc768d10b5d2f37174ccbf7ee67c00ab
MD5 d2921c1cdeaacf31b51d1b97f659a075
BLAKE2b-256 d621c9246645df044270e5efc51517bfd45af83d388ac116d7c6133384b4b76a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp38-cp38-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3dae9943f2beb5b75db6b03f4f552829191d6056319499245043d757cf2c8811
MD5 3cbe4a07a060fe417ca68110f24fdf1a
BLAKE2b-256 b7deb583600c1719eda6aa108d2ea1338443b102080fd6e8771e977ba4c71870

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 67f3867df76052bca3b8203761424b957c4e2b3f5e29a605511b5a6bc08a5fe6
MD5 1b4971821779c151598c8084995671b0
BLAKE2b-256 47bca9926ccd45683f98d38f5b423f0eabff76fb2512fe57a74df888923f875f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401111704620238-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3766eeee55f571aff978df6c8fdf681a0ff636178268b7ec8c04ee72a57ce857
MD5 422ff6809a24d46183b766fed9cc4715
BLAKE2b-256 66f1496ed5264303f5858fc15ee36b03afc93ef52c1a0be67c93a9768b8c5d87

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