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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501261731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 60c4b53e53f77000427e5835f71706a731c883ad8dd9c486dd65be9ac1756ac0
MD5 17093c637a736dc3a8837aad3f425557
BLAKE2b-256 dd4a82659c73fb82fadab2d2af1fc54ce9a2191fd302d65dd34955536d854a0c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501261731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e5ca77596755fb40a4d3c446b92b1006a1baee6db9ef3a8e99f66fb4785fc59a
MD5 52a1e393d3723a7ec7061c82160acd67
BLAKE2b-256 cfcee4689b0ac35178f18d6fe5439ad6e361a4d71711b16a8d358f0dd2e96ffe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501261731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 565acf13bc35a797109d7e52d5db44d359f6b684e32fdff0b7e54bc88e92bbb2
MD5 87e4f8a80bb3806ff6eb918e3c62f697
BLAKE2b-256 4a6475abbd051c1eee05bfdbec9a12f6a2f28a1bf3bdafc6b7e5dd322171aab4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501261731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 12adbc47b7086b98f45578253a664a1347cc0d4c092206dc42ee5aef82858e14
MD5 d0bade23c2bbd8405d0877038b3241ef
BLAKE2b-256 d6a91b15d6c13a911875837cd5da32f83194765f67143dac6e055004900ead1e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501261731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 995205a134e8decc771331ccddd7eedf81f9247ad8b409495a414fea382120b2
MD5 d9a0c3d959811470ac1149561e82b0b8
BLAKE2b-256 9736c39520d64c7df573ab4be308c8f8f9660eabd36fdf3e128d0a865ede168d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501261731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 648e12b11dbc937f07aaa89e1b79e14054d1073ef15458260ac9ca717cc8227e
MD5 9f8ff319842db6856acf8d681869ebb2
BLAKE2b-256 6df1758063a4c2f98e00e71942fe1ef1f9d37c9a9b355aa1f28e5ebb73d2f4e9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501261731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cabbabd6e0e2e208e52c3e7c8a426316f423ea7ef65ea9bdd5bea70515a2d5af
MD5 ac0bc63a7d70fc545c07fcd6e43b399f
BLAKE2b-256 794a1cd702551c44620a177b9245a3b5f148b6a2a2ce12170e98b589c0bc68ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501261731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 289a35cc8bbd76bbefd60699b8837a6d8ebcf63aa95b4bd779aace71aed1fd3f
MD5 8726a90cb032eaa9dfa1883aa7e3a2bf
BLAKE2b-256 c29e4c70f663c38fe7ca18e2d21e0a68600f9002812f8f776d08f90be9aaa07a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501261731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 03054f60624570a23584bac0520ac4d2c339bb92be1e79d9d4939b28fdd9684c
MD5 adb497e3285bbed6390dcfe6ee7b2bdd
BLAKE2b-256 9decb630926de9449be931c95ce3f3b3ee7a912b45d0e18200953c6c420747fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501261731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 78e63b591282e2f923eda6071ca11cba5781be302683750b38e338f72fafdfc0
MD5 0a9896f3fd1440fbedaab789352e668f
BLAKE2b-256 93fc56ae71747cd8beefd6d49bf98d0c32d93a0c30318c9ad5a49484a05e1510

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501261731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 cd2c22453aa2ac6d2846e7035ff84f1f562da9f5684b04f7883b0dd90b699299
MD5 d484b8544c682b9db592c626b405d0d4
BLAKE2b-256 f34b4dac1b695b9e26d56a091defcc80fb4dbe73797e8af472381d62916d648e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501261731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 88faee536e09c70f0f5df16091c0b19ad4741de6a6700d62574ac72b4a21d4eb
MD5 9dadecc0f29df59d9b9a828d9a88784e
BLAKE2b-256 66cd9fc541ba1d1343b1cb9d01f68944fa0eaaf119f8e40b372c1c87877c1bd1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501261731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ed91046e457751e1a8be87443272be5093af48b46fb0b0ee6c575d4dbc62b56d
MD5 8309e156000151e08bf8fd0a6836ea7b
BLAKE2b-256 c284f2df2aa0c66195854296fefd898bef85ad017efa80f5d2d93820bb6e2fca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501261731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 785dd90d1d8b70b1d1de90a4a4222a3d5633b9176d591ef4d49f1820ff2a9707
MD5 abd9e1761467154b1a843603dbb690f6
BLAKE2b-256 0a6b56479e46c94440f26eed9cd672593d0148f790a14970c2a956a1e7218c82

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501261731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 465638ed25a2622585878d991d731ef76b7918a52b290978e6fad4db4efafa10
MD5 53a38aef20a0b8f3949c6127b3b46848
BLAKE2b-256 31959188726e641d258ad1f78d684a2738eca885b2cc13b6dda462ae560b37c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501261731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7c5ecbea8f200b7b4f2ad1fbe4379313191ebd9c9978d4c0d1a4064593fc134f
MD5 95547ca2968e47d3386488875ef78ff8
BLAKE2b-256 3dfcec4a38b7f7e2773e95869e8b453d1b56976e55f734e912f0062596cccbd9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501261731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3359e82b1a54ed9feb4021a5e80b8781b2e0d559013fdf7adb27bf28e4e5d5f4
MD5 fb59f0398fbc83ae89be86ced71ce19e
BLAKE2b-256 b2f7e58f6c51caf92b87351fa1caf414a1ac8218b3d95590d149e9a1f1e2de05

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501261731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 aeb020964a2cf8a5844f21d2aaf469a2ffa9b319b241a50daf9346df2204d5d8
MD5 1d3730a1dab1bcd456cd51cf1849a906
BLAKE2b-256 fc2591fe63cb6a84a7961c9ac1ec5303c7f902f5fcd44eec9e52de5ca10faffe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501261731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 41dd62ab12dc7dbc16d3628933d42e62c1bf3d90d814a67eec0a25b69e16ad54
MD5 d80ac19f0a004469e2114995bda5a7a6
BLAKE2b-256 9396a4a8c8110d8c770ea43f96e7d3fb1f5fe811ec778272d0e7a817c7f877b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501261731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e0be72decfc9b1c48bda2f20f21c29cf4ec5829ceb6f39f6f8e2fca41089e823
MD5 2daebfa099993d5c84a392b78b1267cc
BLAKE2b-256 9af041337aaf613cc0ba775726935ca506cb3a684af910ce74dc1923bebd1c53

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