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

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.0.dev202410271729615378-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202410271729615378-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.0.dev202410271729615378-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.0.dev202410271729615378-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202410271729615378-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.0.dev202410271729615378-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.0.dev202410271729615378-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202410271729615378-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.0.dev202410271729615378-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.0.dev202410271729615378-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202410271729615378-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.0.dev202410271729615378-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410271729615378-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 9a6d46131dadf1f441def81a84a05c7b6c9d11af195409e2aa87e458f8a19782
MD5 a917d5332ff0d1985789d073dbe1f4e3
BLAKE2b-256 4e231c149f46f1c9943cda9afa6bcd9771e2d5ccd6a0199ba585c47a4ef0fa66

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410271729615378-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410271729615378-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 abe3e03e30065dcdd6addbcc3ef4951d041fc2b78743f8ed9492006d05f2c10b
MD5 29636e0f95908bc1b102394c825c7147
BLAKE2b-256 a16ad6419bde75ddc7af3bab78bd6444731e49c7847df8393090555083b29037

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410271729615378-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410271729615378-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ff2a82031e9999b03b320cdb71892387590d21a1aeb5ec523bf29b563e6e125e
MD5 afdb79bb154b0ab695cb827d42c46ba1
BLAKE2b-256 6e8c0e39ce158d16a5fa02a589ca74adc6f231d41806f6482db7eac21e6a415f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410271729615378-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410271729615378-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 558060ecd617225327699401282424ccd793cb69f9f62924ef7f663c0352e728
MD5 a53d3601f3e3f38c08125c6ce351c0aa
BLAKE2b-256 4d62b42b8e941aa8e24ed62dd599bc89710337a1b9894248eebc178690d0e372

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410271729615378-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410271729615378-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 6dc66d4068e1e7817b16dfcb7d1c80f4c51059791a6c28a99435290b3e1ce287
MD5 87a9a9466838546f4e467fb4c716f501
BLAKE2b-256 b5d05c6dd376805e51fe8c4b770ab04fb54866f941ae69f9016203ffda7abde3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410271729615378-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410271729615378-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d814b85823b53b9a72304a43610ae6275d9f564e2b3f2aa9f30b39b0fe99b257
MD5 c5677105fc031af428ebabc28bb52a41
BLAKE2b-256 57a8b0c58c72328d0a126fca1bf5e57454ee7306318833e2fb240c847857b939

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410271729615378-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410271729615378-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 eb14c198d7fe8d5317aebd1197c806cbfb52c077110f8799321e18ba57777d30
MD5 f1014e30aff6f25193f0605f48ce291e
BLAKE2b-256 cd5edbb3871aa35605b0e836aa23f8154220f136689601886aa4027b9bd7e2b5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410271729615378-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410271729615378-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 701351703b2deab2dcb327ed771dceba89a6b162ba740ae71bd7f8e28479315d
MD5 b8406292449de0eda134e2ba7f925ac3
BLAKE2b-256 f986b2b0d5f50bf4d4c9276f65e746d4bbf114880b7d3af629443c2494b0b5ea

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410271729615378-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410271729615378-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8daf16cdfe7b7dbd79434c7c6718e6578a0ff0f0117c51f27b91b50fbacc85a9
MD5 f55afe6a87d87f7de49bdb29f1635847
BLAKE2b-256 c72e4b299356b9d86861f26717b032fdf4bd7ea16332023ede4a3a35ba17b136

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410271729615378-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410271729615378-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c42f2facfab1b543dc554f2a316bd7375239ef831459a43406ea6bd0d6ae768b
MD5 0bc230a502be64467def3184a1ee95f2
BLAKE2b-256 f35fb59096de9736a60b8739a07dd6e4e571d245c7967c997dc3605bcf1dc967

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410271729615378-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410271729615378-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 9ed40280f1477d677df2fe5f360db6c2949c603dea9e3a50f711e3ff269be726
MD5 6f5bccecdd2b1a7df0ca51edcd781d7c
BLAKE2b-256 f465cc49a60ddb94fe164ed47c8c79c159f3c2bcec32e06eadb2f92f0354e2e5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410271729615378-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410271729615378-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 550038a2acee8decafb8cd477cf6da4d5c47ca02cb26d7448a8b5a24ffa1a73e
MD5 7de950981ac29056334ec732bbbbfa7a
BLAKE2b-256 1b5a6017a5eb206c2b9dc1c07b6ed7e14caffd1378f2eff518dca6294a4a6b3d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410271729615378-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410271729615378-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e8cb432bfbaf4cdc977ff30831c40732de61ba95fb9f672ab227d96e442245a0
MD5 da3a3f8f68a4e8ff837c7a266dce749e
BLAKE2b-256 5967060d4d5ecea77aa13376eeb0c0f55d793fdc60d33b30275d508687301003

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410271729615378-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410271729615378-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 059c6bfcaa2667c9d3a56121acc586e7a49fa5e7aeec86095f310f32bc21c26d
MD5 081aabf89fd0900d46ff0d9db60e6793
BLAKE2b-256 95be423ebdd811adade20d4e1a426e918906c183ea1ce754ff72c4cfb4eaaede

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410271729615378-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410271729615378-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0ab8c2f78b629de26dc61f9d19520bd95ff3965c49cd16d9992fdacd2e3a019f
MD5 64ea8ee9a1d5e4edcd7b77b91ac7bfb3
BLAKE2b-256 ccde35561ffe49563b56a66ec4dcc73b1ff144ffa735d5e17814fc9a8e19eb73

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410271729615378-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410271729615378-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 dcbe388a715501fe7d33792aa87aa7b6fe03aabbcad514ed0dc7d94ac30e0d24
MD5 553a4aae660659f7cd58650aba9f6db2
BLAKE2b-256 ddbb4b80d70635cd1c43858a93a1f2ab503de163c2390a88fd4c960295a2a61a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410271729615378-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410271729615378-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f7aa74dcff5148b8376bde14a086a1a1a78fbe06994d38c4172a8062c94c2c0c
MD5 346ff6b418b48654850887337a604460
BLAKE2b-256 6c169ec2a3bf6aaaed859db89e1d281183bc1110c5a37630de9bbb87adbd7889

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410271729615378-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410271729615378-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2b42a98381b374cd9807cbc7b3896bce1272b187da90599353ea096cbae10ef5
MD5 cc6a20c3e2112f989da808ccde05ccb1
BLAKE2b-256 89509c2b4bd3ae41a4c7ad7fbe4f0402f95f875cd91218b018685dac4e9dff55

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410271729615378-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410271729615378-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a27c2193a1b1358235dc790e087101931f35a7b672407bf35ebf4fcb7b55e57e
MD5 364b2e4e5d106ed6b09c397bad33b803
BLAKE2b-256 cf19780493e098eea9786950e7f5ccfad42c336fd861a1313fe75d8a190529d9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410271729615378-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410271729615378-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c925fb164475ae234e56bd521c855e4833daabb6835e03dd5034e9c4cb315aba
MD5 549ad9e881b1eb011a150fb7be59c37c
BLAKE2b-256 9c738ff156d4215c9fd28191bb74c9c166326ca14e4be15477a59c003e767f22

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