pyAgrum is a Python wrapper for the C++ aGrUM library
Project description
pyAgrum
pyAgrum is a Python wrapper for the Agrum library, to make flexible and scalable probabilistic graphical models for inference and diagnosis.
Sample code:
import pyAgrum as gum
bn=gum.BayesNet('WaterSprinkler')
print(bn)
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 ?',2))
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)
# 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)[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)[1,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 evidence
ie.setEvidence({'s': 1, 'c': 0})
ie.makeInference()
print(ie.posterior(w))
ie.setEvidence({'s': [0, 1], 'c': [1, 0]})
ie.makeInference()
print(ie.posterior(w))
LICENSE
Copyright (C) 2005,2019 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.
Maintainers
Lionel Torti
Gaspard Ducamp
Project details
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
Close
Hashes for pyAgrum-0.15.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c8d53730d93c086e012bc0d0a077fd72dd2bb01f9dbc0d8193b0e02a963fad2 |
|
MD5 | 141ee0e6b87d8533c962c89665ebc5b8 |
|
BLAKE2b-256 | fefe580744c568d8d7b4409a16f797979b24380255621a6f3f661558a7d6decb |
Close
Hashes for pyAgrum-0.15.0-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d0637c9363c3d3b9dd9a0e7137b5ec2e20bd66866de4adfd46c0aafc9790c5d |
|
MD5 | 591760ddb46614aa0923e459b46592f7 |
|
BLAKE2b-256 | f533049a2cab8ecd601c4c2637f396773a18a23d8fbc6a15447b7f1047779a19 |
Close
Hashes for pyAgrum-0.15.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af78c14cc68343bea67971a06f18302ee99d3f527350fe13a20db077f12a7773 |
|
MD5 | b91821d95a1e75929c00eedfb1378185 |
|
BLAKE2b-256 | 0fd9550ef8f47b83371f8234dd766d024591e4444c25cc60fede9cafac60a16f |
Close
Hashes for pyAgrum-0.15.0-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9de503c201fc3c023043fb2f6e04da8c84ef3698aa56adde253f2a4376a004f7 |
|
MD5 | 353ca794190e1af3f17cccd181342911 |
|
BLAKE2b-256 | edb79f0c1c29820b5d7c2951adee156d9690e611221c24bdccf66698b86d281f |
Close
Hashes for pyAgrum-0.15.0-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 415fce99546daf98c9647d4487fb178e29faf829bbeb8d81fd787c29880ca830 |
|
MD5 | de0e3c9513b7d4278afa2b9d3e2b1a94 |
|
BLAKE2b-256 | 56d8a27a4561fa7ce511612b8dd46701392bdf3e31494a0693c5d60d6c767cc9 |
Close
Hashes for pyAgrum-0.15.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8188c9efb0f4c51ce0f9de785e0d9ab721134201d23b06442ce9b0b93672b890 |
|
MD5 | 9d1e736d9738df2a85e1c0b56cbad307 |
|
BLAKE2b-256 | e7fb3fa83811e241fe41404fe3b597851d0359286bb4a744f36a5429909eaee2 |
Close
Hashes for pyAgrum-0.15.0-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc05d46018d52ffc9330a6699c8d1ea637341f5b72b6b8e8946095eded5e5f69 |
|
MD5 | 0981a91867ad5fe398aa0f7124bfd1c0 |
|
BLAKE2b-256 | 7070bca7d32627075fbdb1ccc6b859377134f5668afd3d17aafc4a229bd0bdca |
Close
Hashes for pyAgrum-0.15.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6717ddd215575108df5e1254c39d896648dfbe3351664ee981370cb885f6e661 |
|
MD5 | 6e370924ce035ae2da6a094f96233805 |
|
BLAKE2b-256 | ebe9696c451ea1f662b553687214f40afa1d0b54c2453de97dc75137a8fbfc29 |
Close
Hashes for pyAgrum-0.15.0-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 773ac35ec191b0435b0218cd8127cdffc8346f3485e55d7f7a3953772f914803 |
|
MD5 | 28bfe935d4ea84d1c5190bf6a2efd3da |
|
BLAKE2b-256 | 8aa29e58306f3c3d7b7373f6698aca0f9d38aabc44821ef4684a12c4d7e678a4 |
Close
Hashes for pyAgrum-0.15.0-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b19ceebeb5dabef35e42d5a2a8258f354db8e3c926feeb39b8f8dc96866ef27 |
|
MD5 | d7c2d307445c1795881a1f86f29c7abc |
|
BLAKE2b-256 | 74fc17697e480fbefdc8a3a37238c751290e71ce204808e98d07d21d9552847d |
Close
Hashes for pyAgrum-0.15.0-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c25393d0e7f55be84ad21d8002c0c308ee9eeba1c12d48cebf0d8b8d2d12f07d |
|
MD5 | 216c4d44ba88df897f3db366dbc5d32b |
|
BLAKE2b-256 | e1a928c0c712f5ba36502e934dc09ac5c5da21f06e5211a9385c4551e8caddf7 |
Close
Hashes for pyAgrum-0.15.0-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80f0e6277811de1f7a423a09e25d193646eb6dc1e8d70c9e173c8eb59712037f |
|
MD5 | 48ad145363b1944dfc5c27509bcf12b0 |
|
BLAKE2b-256 | 88ef3f1fdc84b15a90197ebfffa95bf9ceddf78251e1d0c549cac0014b73bb41 |
Close
Hashes for pyAgrum-0.15.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5e447afa924fb4123f325c4f04fbac5d7553a2936251923eff72ec45f8eeeee |
|
MD5 | 0566062de85d94a36eea57fc86d11142 |
|
BLAKE2b-256 | c22b60619d179930dcfa2282dd69379783f3711bfcf563408acab1ef5a122430 |
Close
Hashes for pyAgrum-0.15.0-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96ef506c58859d7ec241dbd03656451736d0b6f8bdae7cf8319051600e3ba0a4 |
|
MD5 | b30bcf71aefd6d3f5611ee0beb33bbb6 |
|
BLAKE2b-256 | 414c0a400b15fc39ab1027b4bb0926918fcfd6db548964362755cdbe60c2c4ef |
Close
Hashes for pyAgrum-0.15.0-cp35-cp35m-macosx_10_6_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d5c96606d36b62aa2cee81d9b66f4b0312a36b042a7f55a2703a7ede76059ff |
|
MD5 | 0a6b272a4349449d78929ddab8603131 |
|
BLAKE2b-256 | 679ece4cd74198a0096fb8e63c043b7dc0cece86ccef11402825d71c64846274 |
Close
Hashes for pyAgrum-0.15.0-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3409cf5002bdc9bb78beb4286cc28372eb498c43c9ef293ebd8096138866083 |
|
MD5 | 7b45885fac584b4b6412254eb3513148 |
|
BLAKE2b-256 | 11e5841937bb8f740a06e871bcd5fcab114422f7e61b7bbeb245dcccb967f9b2 |
Close
Hashes for pyAgrum-0.15.0-cp34-cp34m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e3dbe8bdb6d5ad4572df673981351b94aff8722f77b14aba044f3ccfaa85abe |
|
MD5 | 924bcf19c29cebba3fc54f4ef19e1a0f |
|
BLAKE2b-256 | c0f00345abec32e09cd1a9202a74cfc99b67a1984463dc6a12cee0bdad53e1a3 |
Close
Hashes for pyAgrum-0.15.0-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a25e0af577d0d4088bad29b7bfefd8c1d4a752e4c070c540baf62fe363bba582 |
|
MD5 | 43117af9a3d0579c330df01e8b274017 |
|
BLAKE2b-256 | cc743f932baf5bfca5cd7e14f61182bb438562908f0aed8162940f11d0d35269 |
Close
Hashes for pyAgrum-0.15.0-cp34-cp34m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78b566200f1052250bc19bc5258286e0d76c3ba5672a956a145abe60b25bba77 |
|
MD5 | 5857a40538b3577bca607e98a97f4452 |
|
BLAKE2b-256 | 777ac4359314d50c829238b00434b34cf694833e02df2b4b912cfdc17e8bd791 |
Close
Hashes for pyAgrum-0.15.0-cp34-cp34m-macosx_10_6_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 148e86e26f4a450e8d210da2983a9e8d109f260069b6e937c154e17efe0ff954 |
|
MD5 | af4738255fc4657cb6909493c38ffde3 |
|
BLAKE2b-256 | 50afb8e072f2ea7b6bfd2516fedb07faeda097f8a422f3ab191472fc464d4485 |
Close
Hashes for pyAgrum-0.15.0-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9c90eca5578e2e4f193954131ad494bedcf7f4fba91f11ce11432a40fe73305 |
|
MD5 | ec9094b8176ebe3ba5a043eb2dc61725 |
|
BLAKE2b-256 | 4dc54bdfc28b484dc73352cf49f06c9effb904bdd7c95cb3b950f46ceb86764b |
Close
Hashes for pyAgrum-0.15.0-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e33165cb8c2b92cbc36761852c650121e802f2ccf30d5f09126145ef8d90250c |
|
MD5 | 0c359b27a24164450b2bc37c253b7e3d |
|
BLAKE2b-256 | 231bc0372514351172be6e1620b342efbc1ba9a2c272d74862432f85ba97da48 |
Close
Hashes for pyAgrum-0.15.0-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2d24b49f62d3f1d99eb027b00a9513f8e1af879b33dc3616ad93811ccae2304 |
|
MD5 | 4f637f0feb7733705492094d7de4d635 |
|
BLAKE2b-256 | 7e8a4aaf9a27b52a319c259e39b6db616265cfcaa110dd6ac515c51c38c374b7 |
Close
Hashes for pyAgrum-0.15.0-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73e368e71a711be3aab816e1aed17472a22beb418284880c849519675eb5a619 |
|
MD5 | 0068978c0632d59498d3cd5a6269cf2d |
|
BLAKE2b-256 | af4cbaddf6540ffb20cd52a78953e850c955ff78f3e477edd938d8265d84978c |
Close
Hashes for pyAgrum-0.15.0-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6ae4f749ffee3c37043e6ed8cfc7f9847416e832b319c963c40d3e2ed7a1c6d |
|
MD5 | 3baa71181e4f83201105977e5baa8443 |
|
BLAKE2b-256 | 77879a700daef1ffa3de0c09345fdc5c19d6c783b2b6c3c67a3d3256fb3bc051 |
Close
Hashes for pyAgrum-0.15.0-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f17d5b51f7d18a544a3a9459652849fbe1e812b6475323638e7d378a6c9b2dd |
|
MD5 | 514cc658d1d10bc7eff679d962bc77c3 |
|
BLAKE2b-256 | a17d6481c39b3f7eeea4e94ddd17a2d8dfe556bf07ee71b8914cbcec2f5f7081 |
Close
Hashes for pyAgrum-0.15.0-cp27-cp27m-macosx_10_6_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1125816678006890c72c7f274014c1305204152dfc8218df9617e69c0d80350 |
|
MD5 | dc668641d65e9a6a0a2b2fc04b94acf0 |
|
BLAKE2b-256 | c862211b4633ca9d179722ba5087812489b43acb0965014a896c317b31188458 |