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.13.5-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88e00a097c71a2e390b7a2ebdf3204faa9e92316f06b5e40fab3af7cb835b004 |
|
MD5 | 017baa68a6bf2456c6fc9c151c6231d8 |
|
BLAKE2b-256 | 870dca78d26b58ab6dd4ff369bf1536059af31c100603e36e64b5c30f53cfa09 |
Hashes for pyAgrum-0.13.5-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1691e223c43315809dc045cddce485df0781420e66141b8287c53d62cbcb197f |
|
MD5 | 5ac20715763bea42911fc8b510058747 |
|
BLAKE2b-256 | 5cd4fce980fd3d0569dba63756ad10380f0f6fdd74f319e1914d99f76f58c520 |
Hashes for pyAgrum-0.13.5-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19e568f0993273cf6a93995a6391209277a31795cf6a922dd27755c1dfd36f82 |
|
MD5 | e5b413d62677fc5dae25dc897268e3e6 |
|
BLAKE2b-256 | 5d36c0372a4cbb0d0cd8c15cd286eeb3294205cc2cd01de4a9566badb2880ac4 |
Hashes for pyAgrum-0.13.5-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78bfb935214c808ef43b634b0ab72bf19fa86827ad5022e48f4e83240d9e9e60 |
|
MD5 | 657ee79ee5ed2124d4604d1fa421a203 |
|
BLAKE2b-256 | d3192f4227bcdcc3394abf2e2d2bf35821e5d74d58dcab45f65da2ac52caba2d |
Hashes for pyAgrum-0.13.5-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09fc5e73c9785b22b74c31ba5fd977f7cc5c028cd5a819ea4defbdf260aeebf4 |
|
MD5 | 1dedf5d8f233a19c5e0287fa71c4f4ce |
|
BLAKE2b-256 | 19458b11702e7adf53505ad46b14e9cfa4af4c484bb650efc5c69c6c9049c23a |
Hashes for pyAgrum-0.13.5-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7aaf6d67e2418e226f3745939c61303a72f2db8ead3b6e03ffe767b7a7fb0b8a |
|
MD5 | dcabda3892f167ee90343fecc81f49ac |
|
BLAKE2b-256 | 1b40b1d7825a073d3dd992914267ef561e1092a78131e9d646310c28f2dc2093 |
Hashes for pyAgrum-0.13.5-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69e3ba0ba7510e5960e82bd7e475d6dfbb5ef7c8acf6dc764694fe39da495fb4 |
|
MD5 | 563a98770ce2802cd38ab8d5001f89e5 |
|
BLAKE2b-256 | 9a0651c9f38bdffbfc17c66e48b9b9836fee82ee140cae0ad72712b2472b5833 |
Hashes for pyAgrum-0.13.5-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0546371c40638e166d0b7b11d4f183510bd43f046d1e030cb7d97f1a0293e7dd |
|
MD5 | d7b1487616d80dd92b22c6ce42b6f8c3 |
|
BLAKE2b-256 | 64c505a374b89307eba216a355d1f710b8f08968dccc15c97b3b83a833dd2a8f |
Hashes for pyAgrum-0.13.5-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fe19b35a65927ec29d25a7facedf0b507cdf2b71118a61f0811cd85a78edde8 |
|
MD5 | 6949493b3b8361298308d18717158a91 |
|
BLAKE2b-256 | c90bab54c1bc403f8e57015b4a156fbaee7e8f6916311371dfd85e4944afc274 |
Hashes for pyAgrum-0.13.5-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99e32c52ada3dcc852487e07fcea805722def756de279a5cb656fea7b5292496 |
|
MD5 | 160da7dc2e461a02ed3df9a17824767b |
|
BLAKE2b-256 | 7290d391fc459030e1a255f42c31d870cd035c378c32f94ce808f35800ac8a12 |
Hashes for pyAgrum-0.13.5-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82e152dfd1fbfe470fd29e6e37f9c24cd82b95de8a3048030f1f035d3aee3d2a |
|
MD5 | 97cd40c04a4cad55e015cb9e42f913c7 |
|
BLAKE2b-256 | 87456da4547abfabadffa0c66bacb73e8aa6fee8a95434816dfe1bebecc25be0 |
Hashes for pyAgrum-0.13.5-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63be5ec65b8381fdba624e3758189d92fc30ed28c8de6d3be7c9e30e9b8a23c2 |
|
MD5 | 76d64a48bc8ee8aafb70128b70b1af64 |
|
BLAKE2b-256 | ecdea7f22f42909ed1a91e4e0a68fdb5906ed9a8b9700a9bcccca7b359f99fbc |
Hashes for pyAgrum-0.13.5-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bc164990b494e10283dddacd551b4bc3edfa3599bdcb401e522f5ffe7f92ffa |
|
MD5 | bc4c955c203f8b1b7cfefcdab85897e2 |
|
BLAKE2b-256 | 0b57e3adb7d495690817ba1150f8ddf1322317ed2e11501294ad4dc51a3d5e5c |
Hashes for pyAgrum-0.13.5-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 160bbd50cc8261150916a82187a9e520663e76c55d9ec04efe8e4a696dc50b9f |
|
MD5 | 2dc97eb06097165dad526e24fbbeb20e |
|
BLAKE2b-256 | e94a90003e94d067bcc2dd0042af9a9754e592f73ba24d306fc4c7798b30ba66 |
Hashes for pyAgrum-0.13.5-cp35-cp35m-macosx_10_6_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7db5ad7fd616807a44f21294b56f03f1f97bdb148c05426453bb8edc1b23dec |
|
MD5 | 6e6acddc5b5c0b32c4e9344412d9fff6 |
|
BLAKE2b-256 | 705a5b2c5e791b3fc13111fcdad1e39eeabae2ac1957bc4fdb0c0aa47b83d2d6 |
Hashes for pyAgrum-0.13.5-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2f15a1b1e4c888fbb4392eb58589142bcce9b941536065d822f2d24f8435c99 |
|
MD5 | d104450241ee057eacbebf7d7c9d6084 |
|
BLAKE2b-256 | 4a51fc17450b47cf2b1197fe14da492422be53aea76a4a2c32527c2086317ed6 |
Hashes for pyAgrum-0.13.5-cp34-cp34m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6688687c1c52c7f8fdeaba657a860821efeb27add3ce55e8a3ca126b9fbd04a |
|
MD5 | fdbf2babc42c5b67c6fe76a30584f7b9 |
|
BLAKE2b-256 | c1d24c1d94e310d119f37df24d826f48f0056f94170039aba06e5ab04ae05a17 |
Hashes for pyAgrum-0.13.5-cp34-cp34m-macosx_10_6_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0feabecfa92d165e454794700d310e1a90e84531781a8643a0e3ba7d8aa5b82a |
|
MD5 | 99bc0f811f3fcb655011c6ee3fcbad92 |
|
BLAKE2b-256 | 0076bb9962b1628d36ac385ba79f2b63943c46c504dece2c3f40464c375dd606 |
Hashes for pyAgrum-0.13.5-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15c766524b976065e480c7a0823f6b425f55c3e89acb23b614c471113cab295c |
|
MD5 | 9e1d1cf4ae0e38f0cfdc247b3f2c2a83 |
|
BLAKE2b-256 | 52e84f662231efc7de925c0e1eaaf0697b3fa8677242dc664dbbb33631db54af |
Hashes for pyAgrum-0.13.5-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ab3df8c8d62504a932dcc7935937773d7f8358b8af9df551cbd078c882399f9 |
|
MD5 | 6f019d2033b2ef285545fde2ae631b2b |
|
BLAKE2b-256 | c06f454d5c99addd7dfe0cf59c2932b3773d5bfc64e3e0ca93936e8b2b8d7334 |
Hashes for pyAgrum-0.13.5-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad8b7f02ce3c79d8fff76e4525d469029a09f65569699ed81a8c651fe862b65f |
|
MD5 | 4f45837317e17dd23dc41042eee11d99 |
|
BLAKE2b-256 | 3b6cf51c5f433ff623424b58753d868343f335285d31e21b689a1dfc6c534506 |
Hashes for pyAgrum-0.13.5-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd6de854fa6ef37a9fb5b05674cccfdccd9d9c276e6db508efb485a916f4322a |
|
MD5 | fe616d5c5cc9db670aa2d3a8c5fd332f |
|
BLAKE2b-256 | d2570af73935ee703a38360ccb61c14bd4bc6c14923a411a4c204fa8ad0590ba |
Hashes for pyAgrum-0.13.5-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe6ce85c3a93e93aea7d0c737e149212350ae1468a7496fc47bd171d583602e5 |
|
MD5 | eb69dc9b6754ebb4046a764ac946d0fb |
|
BLAKE2b-256 | 66d153041e7ff71587ef03455743a4b47b3967595248e106bedbd1b09186f729 |
Hashes for pyAgrum-0.13.5-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ac018f51fd82c547e994b1f0f013ae552e760128d3bb7bcbe83fc0739194cc8 |
|
MD5 | b697db560b7e9a1cb72f0488af7220c7 |
|
BLAKE2b-256 | 8e64a9435853fe75a51eef7095bf0548555a948bf3e099632770b71e7b92924c |
Hashes for pyAgrum-0.13.5-cp27-cp27m-macosx_10_6_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9aafed3a54b8ce74b8ed03725f6a097eaf115f9ce803f12c24444adf97d1ba64 |
|
MD5 | de75d025d47515cc67a1c6fadd6873ab |
|
BLAKE2b-256 | b849bf2b360d600b5e34eba66e380ce0159a5cb8749425f8b6d69b000d3f2985 |