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 by Pierre-Henri WUILLEMIN et Christophe GONZALES {prenom.nom}_at_lip6.fr
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Maintainers
Lionel Torti
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
Built Distributions
Hashes for pyAgrum-0.14.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2391e57c971462a8c34167529cf835a7ca6342ea96f1ee2d680871d05c8c63a7 |
|
MD5 | d266a590c6e44f1df6f3c36e793bfbe4 |
|
BLAKE2b-256 | 4b453e2bbb182529b823edd4cde5719d9fe0265be77107efb9d96cb71b9989ea |
Hashes for pyAgrum-0.14.1-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7976df321601429d34ed8be1616553b01316567c1488e8887589b87ed9cf940 |
|
MD5 | d0b0b7cec626f28f3061be096ffad678 |
|
BLAKE2b-256 | 212b1b2dd0e25af1555199ee465ee23721a8ba6ad2a90696439dcb648a1eeaab |
Hashes for pyAgrum-0.14.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af8df85eb08dbc47d6e28d5f38c8a069e1ba192a55fca32f9521b1aafb392cb4 |
|
MD5 | 46bc44a9bf7655d802c123f2e64fd36c |
|
BLAKE2b-256 | 87ebef98ee9bf25afc387700f8d1e1f8da24e21a5d71300b2f0ac9978de96ed3 |
Hashes for pyAgrum-0.14.1-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c16039a101bed2a5704222b92d6960fcaa423d67868df45ea2859763d43ab329 |
|
MD5 | 6e699be05364481baa321301ed633ec3 |
|
BLAKE2b-256 | b4fc93c4f8f18a73e12032d43b86e8404e9f6e05681f454e13dbfc9b500e1748 |
Hashes for pyAgrum-0.14.1-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a3b0723d6128da044a878337a36a4448d1ea9fe2f90099e5679bb406720e5a7 |
|
MD5 | fb2cdfded592fe0512d2aa6e4618bcc6 |
|
BLAKE2b-256 | f9c813aca5ad17b435b6d2ee521e594144ddc1a73b2f19a390e03f3bc00f6fd8 |
Hashes for pyAgrum-0.14.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 996775e7f55356fc3c4a45719e2b41677955274a76b1aa6ccddfe59e99645ddd |
|
MD5 | d20f09649d9d336b932c194021c2ee70 |
|
BLAKE2b-256 | cfed6d092cc0e354d2eaf2cdf83a4585f25ac0347c2525c89de9e0a18b61930a |
Hashes for pyAgrum-0.14.1-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f50edfb1df8c6bb9aaa9faf25d903ec386826fd3fefa63e396074a0421fb32ca |
|
MD5 | 4ed01d1bf2357a4bdc4689e59b5c83a2 |
|
BLAKE2b-256 | ce5a479d528c5b5c7e6728c479b50464b6b70d665531f1276ee9e87eb57d3702 |
Hashes for pyAgrum-0.14.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 165f2de6a65fa9744a145cd9ccab4c9fde5ef4b1c885539e361bb12a834c5593 |
|
MD5 | 1648e70515099c39dae3132092a7894b |
|
BLAKE2b-256 | 1c1b306129bf34f238dba00e71a682de5ee2aaed262f205cd19381dcf5c38542 |
Hashes for pyAgrum-0.14.1-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ce98751373e930447ca879557b0da888f4ed30a322aef1dcddc5c30350b4932 |
|
MD5 | e0cbb110afd9b04faa1d4b135272ff91 |
|
BLAKE2b-256 | 7dc501a08ce492bb99326c1f8b2ab88df891180f968293c8776cf237b4cfb3ef |
Hashes for pyAgrum-0.14.1-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8174606d7bb01a922a80354de55ba4d2790e8709929afb3c0b2280bee2e1e334 |
|
MD5 | 0d33bb209d1f95c6cbdc3c2e97759301 |
|
BLAKE2b-256 | b366905c5f9df6e3fbb26f258dec7989c741c83f6c42a657aac3a9406a2ddcf9 |
Hashes for pyAgrum-0.14.1-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4519130ed8510cbd15d11a6a0d1d56b8d35dfc3f282572f0ff5856c477db0be |
|
MD5 | e5f65c7356c72a8fddaf67a64a07d92d |
|
BLAKE2b-256 | 4cab1aeae4bec13c9d3d025f0c738bc48a698ec05b85a1998899079b7bcf5a29 |
Hashes for pyAgrum-0.14.1-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5eeb2ef62f4b49135b6d4f072437c65e146ed21caa4f1d15bff00407c721ec42 |
|
MD5 | a03be35a254a66c400887f76115955b6 |
|
BLAKE2b-256 | 31144d709f1d61f7d39d52934af9d1ad6560662be76ebac7bc6081d86b4ed3ea |
Hashes for pyAgrum-0.14.1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61e6a4901a19dbd4f39016d072be687ac66ab7c2db0e72f272583d563bb9a7b1 |
|
MD5 | bee15261a56f535ea7f7892fd045e91a |
|
BLAKE2b-256 | 21f9d7eefb79b85b6cd9a92308f8b1834e5d6c2aa73ac79f7f6f299c660817a2 |
Hashes for pyAgrum-0.14.1-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | acb03bdf44ef06f6b6dd43b76a1a4d1f84b7bb50883b281f295d6a186ea0ab1c |
|
MD5 | 49d7e9369688ac73fe1af5f6a933c3df |
|
BLAKE2b-256 | f341049d4c990736a366678f98f494381a0c76e5fe446acb2bc506c90f308597 |
Hashes for pyAgrum-0.14.1-cp35-cp35m-macosx_10_6_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c1c71b4a91120fb18a2861dd386698fd593a78273309246c1c102bb638a6d90 |
|
MD5 | 62c47d531a5ab1b735ab3e393ac09c52 |
|
BLAKE2b-256 | 1dc155c0e1190def20cb78689957fbc88b3012de5cb07d495c759f2e0c422d38 |
Hashes for pyAgrum-0.14.1-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1ccd5e77f2926413a1d3be416f24128c5c90788f6aa453135c555522e8de0d8 |
|
MD5 | 1253ad32b714e0176862898f4f64debe |
|
BLAKE2b-256 | e05a795e87459b0faa11859e7bc5b803ad0cbb7a786a4dcc02193a219a9f1be8 |
Hashes for pyAgrum-0.14.1-cp34-cp34m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26f24e1063b5f2746b151b6277ff1f09379836ea0f99489b0b5230811be4f6fc |
|
MD5 | 0a6a215385fee05324b66212591acada |
|
BLAKE2b-256 | d7b77f8686b67c99e5d23bed377bf393ece96e703525e0a1bfaa3281e0b055e3 |
Hashes for pyAgrum-0.14.1-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25b483106ea703b662738e9859e90faeb725415c6eece9f82a12a96e0f7922d8 |
|
MD5 | 39685ffac6e249b65e6a6fb8d7669fff |
|
BLAKE2b-256 | eaf86ea783b735859d02dc35b0b9004906097f3124db06fbdffa3f05e672a34f |
Hashes for pyAgrum-0.14.1-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8e08677f084541a8a846f21f46ca7980aae788741918d2280a7e5d1c688b19d |
|
MD5 | 975d6eb8d2df0ecdd50fddd9588c26e0 |
|
BLAKE2b-256 | ba0309efa8614c55a2835248c42d8dcf1d5ba95f50c980598d96180e308bc7d8 |
Hashes for pyAgrum-0.14.1-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5950ac2a55e9381a3103d892afa0777fccf2c6fa897f7cac482effefb8b2dd7a |
|
MD5 | b66239eb1199a2c3d6df8d002b9b00f9 |
|
BLAKE2b-256 | 59e9c581e9d693747528d82eeab03fd5f384bc7ed01e14427297a3d470e173d3 |
Hashes for pyAgrum-0.14.1-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19604e932675af6bf75ecc4aea03b34b7bc6712ddc2463328ab56c02a9ec1602 |
|
MD5 | ef426d0fcd63e4c52e84c7c6782d8a8d |
|
BLAKE2b-256 | 2096a32a1456aba755c41025cc6c48c5391ed3b0579dce802bedc2aee961d0d1 |
Hashes for pyAgrum-0.14.1-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a17ba41d0d2e58056090d20a3badc1c980a39748bd5cd86465f4d170e16fa4e |
|
MD5 | 7d9daef2d50007f9f4771bddfee85cfa |
|
BLAKE2b-256 | 22f9736b76ed37d647428cf603ae731c41df3f43a2bbc44e70227d2473dd8b8c |
Hashes for pyAgrum-0.14.1-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b93fc31fd5b98149c2e53f0e543d50c9b900a5d835768bfd77e7cea3cc0373a7 |
|
MD5 | 717f01aa56fad44d6669b0302163a56f |
|
BLAKE2b-256 | 07c1f63193beea9f3964854bae45ef8a090064753232a2203d9330863d86917f |
Hashes for pyAgrum-0.14.1-cp27-cp27m-macosx_10_6_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11d29c6eeaa5c066b5ecf98622a57691bdb8936b1a68a685548ccd0bfcab7d7a |
|
MD5 | 5a032eb7379d11d497d9a031d72555bf |
|
BLAKE2b-256 | 05a6542809173811ecb5cbedcf4c8346b12f75db149121a621c89dfe4b0cf0fd |