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.3-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a47b1728a8421b2f057d8a6be72732a07b7a266bfdb157eda7b77fbc94cbc8e |
|
MD5 | e37f2914e226240b520b5a02c1434987 |
|
BLAKE2b-256 | 1b102b02c7c96bd362012648f374187dd478ae1e9f13776debbe1c9cad48f35c |
Hashes for pyAgrum-0.14.3-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b03f0f5c6a98fd8f9d4878c93383d328a0d8c1a9dda86b844720373faf94c16f |
|
MD5 | cafb878cb71a2df4772749492c8e9a10 |
|
BLAKE2b-256 | bf858e8cc518b13427a2e6f4b4ad184fd857c98742f75744e9c34d45c7cffa74 |
Hashes for pyAgrum-0.14.3-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7430e8cf801ae076c25d07daebce526e843c10d4a57ff4c37166bdfc138785be |
|
MD5 | 7d69c1b75bef6467c0dc10def41eec0f |
|
BLAKE2b-256 | ac8f3ed6042f300278d7cebd1e414f06ff510f30100511260cb610b16d87c7f3 |
Hashes for pyAgrum-0.14.3-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4bf856a574563e51237d2c5b4d4a000adedfc47996816fdaa91b7d3956cbbce1 |
|
MD5 | 01b105420866f77d5bf014e5669ceb36 |
|
BLAKE2b-256 | d26a505bdc42521a994470ff5a9873eacb920f214470bd98508c81dfe0e96cd9 |
Hashes for pyAgrum-0.14.3-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed895ac81dbb53f3ec7f873f8ca1bccc7d5123c5cee3d2e5d84e7dc8f2b69eb0 |
|
MD5 | a41645a6764c358776b6689b745ca2ee |
|
BLAKE2b-256 | 2c0507ddb87e41665bac73afc3fbce2b5fda1e2510bc39fc9a3f777f8615a59c |
Hashes for pyAgrum-0.14.3-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd37a223e7164f6ffde4718b7259af7dd621ec2cb8615224d752c56b23f1ff2f |
|
MD5 | c54329b1207a57dfcd93d332563fad8d |
|
BLAKE2b-256 | c67353c87538bcf1451cb1fb51aa29fe6813a760cd8ed68e4102d44bee0c869f |
Hashes for pyAgrum-0.14.3-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 805d045b0f3aaad243aa271c7193c4a0f8a0cb5f7ca1694d2e8dfad6e48db9e1 |
|
MD5 | 1c9c6b76b9ec3461b505ef1bc2bc7264 |
|
BLAKE2b-256 | 86046ce52f7bf0c34e6f389eb64de6b5d6cbde803fce0c44f274124a49826194 |
Hashes for pyAgrum-0.14.3-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6568783a84cfa79ca61820045284f769dd176f092d592824d477093374de1e9c |
|
MD5 | 4e36ad9abc4639e1e61b9d1b56acf59d |
|
BLAKE2b-256 | 70ab457d4543a0c8e9e17c3e6fed6747d8c016352f744b4ca6bd773551826234 |
Hashes for pyAgrum-0.14.3-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 750760a7581dc4d32c630cb7960e825a4110d69ed0f6500ed930f013bee619e8 |
|
MD5 | 9e0be36abe9f0ada06af663cbdfbbc25 |
|
BLAKE2b-256 | 1731f3fe6075e89c6076131598e2c444b2ef065598775c8b114ba2949b4ccc82 |
Hashes for pyAgrum-0.14.3-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dda6f5edde51c5e235b91a3beccbfce4994fd9a95a3ea21b5734571ac9f628f8 |
|
MD5 | 48b48b3793afe8ee10ed34d748aad3a1 |
|
BLAKE2b-256 | fa0ac359bd01a737a699ac5231df90a23d9a5089fa0d035c86027777f52bb65a |
Hashes for pyAgrum-0.14.3-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 877527984ec2651e77bbf9d1fe6187644de042b4f109a8f1e8c20184fee00878 |
|
MD5 | 1359fab049ae7f72623469b7c044e2e8 |
|
BLAKE2b-256 | b83ed68228b91255906f55ee26b30d9f48a3cc6d61cfe8b95700d8a0d684f461 |
Hashes for pyAgrum-0.14.3-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 457ee8f214fdeaeeae9bf22101929f48dbefa62af38f3bc7e0c64bd0f7b33088 |
|
MD5 | 8ae8b58ee8319b71f3e31d43e0ec1535 |
|
BLAKE2b-256 | ac7c56cdacbcef86abf016d97b985a00dfc6c18d03e09e5c5e6fe4ec7ee5b033 |
Hashes for pyAgrum-0.14.3-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d7790604e7dc6e0292baa945119dea4d5bbf778bd481df109a40bafbbadda09 |
|
MD5 | 53b30f863667777025301045648f0735 |
|
BLAKE2b-256 | 0c71811cfb02fffffde5e2de739212f8ac7ea121fbaebb1afe6a3ae8247550f3 |
Hashes for pyAgrum-0.14.3-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 937fdc926ebf05d5937f941bb5e77f6d23fa65910d3b8d82ef5e9cfa268dbc0f |
|
MD5 | 6b87973b4e528232df275c69f22e0ca6 |
|
BLAKE2b-256 | abe48cd26d6bd4e983a5690cea054c3837a2b6c29cd0674973c5aa5e114045ff |
Hashes for pyAgrum-0.14.3-cp35-cp35m-macosx_10_6_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c55be8baddab96eb51eaee9a813f294c9988df6ad838494dfbcd85f6d83548d2 |
|
MD5 | 8e1d747e09441271d9f7767df07ad1cd |
|
BLAKE2b-256 | 41c25d9a2f36c939d16ee42fd8ade0e3aa45428b877965c9b4e30931de3550bf |
Hashes for pyAgrum-0.14.3-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91c6e9c6a14bc25a3f143371605514fd0e8ae4c2db332a76eef3d99360be30eb |
|
MD5 | d11afe6ca56d99824bc1786411c51299 |
|
BLAKE2b-256 | 802854b40ddbe0f7f14c2f1fb4c9e8121909c86bf767c2aa48c97a51e8103a15 |
Hashes for pyAgrum-0.14.3-cp34-cp34m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78d4e465c5bee7eb16af7dd0a0e75fce5b6d23c6f2b1e232a202f306473d1f76 |
|
MD5 | b1a3684255506e8dcdc97c4eefb9df4f |
|
BLAKE2b-256 | ec8d620f6649976d41eebcadde7e07f3fb0ff9eb821c423f64f63979fbf711ea |
Hashes for pyAgrum-0.14.3-cp34-cp34m-macosx_10_6_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f823da10649b9326fcaaabb23a36e16cd84354d351d47cee75a889e1efe7f07 |
|
MD5 | 5253100b85706660c51b2101669ca543 |
|
BLAKE2b-256 | 95639ad31e855c59c80190c05bf52976a3fa2b771f33bd337e8a320b028e0c34 |
Hashes for pyAgrum-0.14.3-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e043ad087cc8cb354109ab01f4dc59960bbe52773859d8c4248396a342c9b544 |
|
MD5 | f0354eefe887a6d1706563f8b2ea8cc8 |
|
BLAKE2b-256 | 23f3f48fc8c9f3e3827fc02c563af553126cb589596526112727e8069f51490b |
Hashes for pyAgrum-0.14.3-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9cceb922be53c0098aa8e5a859555f3c374053744b4d9642eb74eed930f6d517 |
|
MD5 | 3565413b4cfa4a8e9ce47c3918126e83 |
|
BLAKE2b-256 | 0201c2c2b5e8ce2f0f24c4df783195ded7cb0286e3e337e7ce7bcb66cca0dfda |
Hashes for pyAgrum-0.14.3-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4948b5a46c9017bb4f047c3e5ee1bb5cf27d77b35759c634aaafb574b5237d0 |
|
MD5 | e17c3827701df85fb50634c51a02d7a7 |
|
BLAKE2b-256 | 6314e99a78b408af83b7f000c481bb75eaf3285e3ad4d8df50a18ced6e1fee04 |
Hashes for pyAgrum-0.14.3-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66bd891bd21c40a8bc93fa985a42a32ee36a7806b3873bba80af80af7b88fe5f |
|
MD5 | 9f57d1dd351cb9d600431de354bb5f3c |
|
BLAKE2b-256 | 762801889276556ddabcd33e1b72e04bf56bb7bbb12c1cbb2a7f9527bb0ff884 |
Hashes for pyAgrum-0.14.3-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ecfc6a08ee99d920667653ab293c7ad170d53f94fa0da0a8175037ff0d0e2c8 |
|
MD5 | e6ff95501ee97958732c64ce4554fced |
|
BLAKE2b-256 | bbee7a951d9ba94cb71c0d78c91c979bd3ba8b3dbb35186ab0a06b178b8873be |
Hashes for pyAgrum-0.14.3-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc0cdb71e1b38983a8e767e8bb310d18cecdb8567bd7bbbc936e8927a83bd509 |
|
MD5 | 00ed7873f09971efc8c0d98d9009d63d |
|
BLAKE2b-256 | 3cf185dd5827aee8532860d045a6a3ce7a514db4c092b9d70f91e9c083aaec25 |
Hashes for pyAgrum-0.14.3-cp27-cp27m-macosx_10_6_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d238f1963a400a5116f2f275dc40246e1dc34638d6efdb96ef2be1978a91d083 |
|
MD5 | 1e0e9ca8e0c4ff8f82ed19eff08ec623 |
|
BLAKE2b-256 | 425aad0115c312e309dbbf2ee57c2a994da4066b7f1c1b85df183e524f4b5b14 |