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.12.0.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 434b2a1a1124300d0982be0a69c5547f4bd61c4c769317226c4ee5ac81b02938 |
|
MD5 | 9ac7b2a6a035ceedbb69f548a55ebfb9 |
|
BLAKE2b-256 | 58dc2c301f9f4b2fb21c6622940d7dccb369af72f447da0d55fae21bae7460ef |
Hashes for pyAgrum-0.12.0.1-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c96ac18c1101eed0edab48c9d6df8b45d2ae0916627e53985d115d8936a5e5e |
|
MD5 | fdc6ca3764edbc404f4b25e4c350901f |
|
BLAKE2b-256 | a23201a8f74e7dd1c171ba2fdd354fa2179bf3402f1845a1d4d82d0c8f2223ca |
Hashes for pyAgrum-0.12.0.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 116e7344f52066056500a00d99bc5d30b71c58f4fde3cee6930d7b2751000669 |
|
MD5 | 134452429ec56282925030406295a783 |
|
BLAKE2b-256 | 6f3c03ef326f034efb4dbdce7b98f57f6b19e22eee2748847e70ba305f5e3f5b |
Hashes for pyAgrum-0.12.0.1-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b902fd057302fa914e3ee839b672260bf4ddf0ba506a7519a4fae971116926f |
|
MD5 | b01ce0e629e731fb269916e2f5a47cc4 |
|
BLAKE2b-256 | 6902a8887a15a06b8b8600d59df9691fc051da030f45a96b11c8384670e5bad3 |
Hashes for pyAgrum-0.12.0.1-cp36-cp36m-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8242abb5429c2313fb7ca883ece7f967b3c0672862bc111802e6a86e7a720bc5 |
|
MD5 | 873bb2ece7cb93d51342229c2c9c7978 |
|
BLAKE2b-256 | bfcfdf1c6ad8e9ee315a307161857d52ad015af3f4c7428654aed9e260d5864e |
Hashes for pyAgrum-0.12.0.1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a68117a5a0fc5c350d885c4f698dade945b06e7c0fcc30be596211919541f5d0 |
|
MD5 | 4b968d58be6558cf9f4c2eef84c719fa |
|
BLAKE2b-256 | 53c5362562657df13a40673c55eb113c2c9e590270a24e2ec25c72437097418f |
Hashes for pyAgrum-0.12.0.1-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85ce83020306ab634875b94b1886b1ba3ccb217049160b10f77afd6e0e582ca9 |
|
MD5 | e18c3f754b83ff3f0759e302b6e6151f |
|
BLAKE2b-256 | b9aaf56860ae0092d8ed50ecd5a5147f6a75d5da2ebc737664a3beeb9418f7bd |
Hashes for pyAgrum-0.12.0.1-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 929b100355352f39a9da7590d5cd42b5bec847cf920cdcfe2ba1c380fe031853 |
|
MD5 | 5c1acdb7df542e14ad13fc231e99b616 |
|
BLAKE2b-256 | 7106aa286abe87a3abeeeb06721fa5a60b30bdfbbd99e11ba39f5fcc0350890c |
Hashes for pyAgrum-0.12.0.1-cp34-cp34m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a70d0fc6ac2a5662309a2755999ea313cc93857cb9ef0276522d953ed3e6af9b |
|
MD5 | 40ead9f6fc20c2ccc07036cccae5112c |
|
BLAKE2b-256 | 22af1a5b5e427684318f891a6a30463ee34562254bccb41cb5d84a6eee97a970 |
Hashes for pyAgrum-0.12.0.1-cp33-cp33m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 087aaceb4f6e75d71a3a4aa5010025b89dbdc471a511c070a88569535e51421f |
|
MD5 | 6ea163039ebb574c6c0dae8ffcfec5bf |
|
BLAKE2b-256 | 7d0e39ea6e611e03eddf32bf41532b749f814173c8892f9f46065ed5736f6e79 |
Hashes for pyAgrum-0.12.0.1-cp33-cp33m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d36224970d5945e845771ca5a568e3dee001de56e989b386672f27d9a325bfed |
|
MD5 | 5273aa822e92eba501318f467653c2c3 |
|
BLAKE2b-256 | bf755c877e7cb6f1e7730ab3c3f262de3f3b52052090b5edb3a3d0c7e199fbde |
Hashes for pyAgrum-0.12.0.1-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64cefeb8b2e97e770b7a4b2affda5391d1245968482c44ed3d70b99dc0cc7b6a |
|
MD5 | ba3d0813debc320109e28399c0e881df |
|
BLAKE2b-256 | 8f69f15223e5698070714de59a4bafdcfd9590b87bedc0997d897299fcbf6aab |
Hashes for pyAgrum-0.12.0.1-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a19da0f8fb4156099b4751e9f6c869c96a91a945c33b34542fa6a475c51a9f3f |
|
MD5 | 17a7643f868d7fab34adbf747a93366a |
|
BLAKE2b-256 | 84fdc1c324ae86159e62a3cb0bcfc253af07fb90b812247aed3886be1518a80d |
Hashes for pyAgrum-0.12.0.1-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 262c560ae4e5965f89adf0286ada1c7fa5b6a8163447ed5f9d1c852e7e853018 |
|
MD5 | 8d4e6eee4166e3a9cb3d836351044519 |
|
BLAKE2b-256 | 700cdf224261aa31cbb8a5b72ecdd21e463358892c06dec916957a4ce3d379b2 |
Hashes for pyAgrum-0.12.0.1-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29a090807fc1bd9ce28df57bb65b9ac17c07e7976d84ee04c9646056279295f0 |
|
MD5 | 5b92f69b8e0498bd1c9748e8f1556559 |
|
BLAKE2b-256 | 5aeb024c8d69cbcb774b6b7ba5d83e7dad03164263670b8b70fa26ebba9acc71 |
Hashes for pyAgrum-0.12.0.1-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45c025474463636c58f0fc767819c060a7b872178bd8873e4ae1c0a7019241e4 |
|
MD5 | d273f080157ef824137f7a24e7f7365b |
|
BLAKE2b-256 | 8e80dfe7a724254aa2f7655f038f093ad883cb87d8b36aba6eb119a3c2d1ac72 |
Hashes for pyAgrum-0.12.0.1-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80be4a992ce5408dc8486631d3e14143eb342a8f2bf6708cc36890a2420f74a4 |
|
MD5 | 9183c3383344bc3ddc907984d94b26fe |
|
BLAKE2b-256 | 5f5b66f69943d714924634b25a08f2f7a299758a3dfa06ea55d6448f3248a6f0 |
Hashes for pyAgrum-0.12.0.1-cp27-cp27m-macosx_10_12_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e90dd4181de2f468ddf7a35e313773e64f9a7a51c804ee05b9264faec3031732 |
|
MD5 | cae2a90a0d386eb14bbb1f55963bf33f |
|
BLAKE2b-256 | 0016ecdcca98a07ffef22fa849d9432e6b401702a799a0baa8ea7ad216100ad0 |