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.3-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c70c8d5be5fab66368826dc0931f420bf99681844687808ac2a1d5d8572d96e |
|
MD5 | 572b691d8c8643f258e3c6eeabd0a011 |
|
BLAKE2b-256 | a87d00f4846fee95092b2cf8e5077581c2e4ec3d1f3c0a19d0cd723ccb3056e1 |
Hashes for pyAgrum-0.13.3-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89c31ea306f451cc7566721681ef70b4e8e3d4368e2bce5ef2769502acdad2eb |
|
MD5 | 19594c3af9f36808dd470f40143c87bb |
|
BLAKE2b-256 | 262aec0aeaf1b3c525bdfe0650be5b1f6d95ccc294c91a6d16edab789bfd9882 |
Hashes for pyAgrum-0.13.3-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f23f470c606eb7707c9ca2314cb7f00806097d622c34b4cc1b2b0d7a3517586c |
|
MD5 | cebf72eb21e2458b684858121f84559f |
|
BLAKE2b-256 | 777b37d6c438ed68086ba64df839263f4f41624f0092b23fb2f317e234c373fe |
Hashes for pyAgrum-0.13.3-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb1be16544dfbfa28b509a98cd0d611461837cd6bf7283d7eb7eed7e46ad1d65 |
|
MD5 | dd12ea5ebc7106cfd51f27d1aeab4f04 |
|
BLAKE2b-256 | fdc75de4bb7ca3bee3c7feeb677dce2a01c783428ea529ca2526b5f0dc993361 |
Hashes for pyAgrum-0.13.3-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec9813231bfbfc5a8481837711d2a9cf976efd8f0c6813909a37005b90bd671a |
|
MD5 | 16361799de0ca2506363e2cefaef439a |
|
BLAKE2b-256 | bd3da48902e3f17b05ad04d073ee8583553b5cc6b4c7d2e1888fa2482b0c66ce |
Hashes for pyAgrum-0.13.3-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7650c0128c3d85ca6086a4fc9ff5e6f604a575fc975688b24e6bf679dcfd932 |
|
MD5 | ed09f8fb3250c041904474e3fca83fb9 |
|
BLAKE2b-256 | 21b8e83c1c477f7848c76c9f726332ef2ef4331457f9f41915fea37352d8552b |
Hashes for pyAgrum-0.13.3-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fced43e683c5f442ee86b6f98c2ef09dbe137606b1a441fa98ad335dedd3697c |
|
MD5 | 7c833a457b5c7737430a356ade5336e6 |
|
BLAKE2b-256 | 5ba2a82a8115c9b0f8b616a37f63693f0eb1b717346fd8020d7926fa6ff9031f |
Hashes for pyAgrum-0.13.3-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80871b69ded14acb1b7515a7a38d058437764ca66cd1320bc17af8e92a7b1ee9 |
|
MD5 | 1715b5e1d93ca6d94425ae8aaa380409 |
|
BLAKE2b-256 | baed8305c4a7e542f1d1e07a2474b03501bd6f4a57abab289f9c656fa20bdbd1 |
Hashes for pyAgrum-0.13.3-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9db09898fe5a8aaccc5d5080fe31ac006802afda5415a36ecb54458baeb5de3 |
|
MD5 | f41b1f8200bc24962d30eed3a5bf057f |
|
BLAKE2b-256 | 8b59ef669946ca8af659e8d1b916632497a2fe0efc686e2ded68a2f55bda0d2e |
Hashes for pyAgrum-0.13.3-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ec77a0013c663d50fdd8093cae6e5a142cb6a64aca72e6420d172aa9438df9e |
|
MD5 | fab03dbc2b53f5aee7ec03638271ce5a |
|
BLAKE2b-256 | a5f93608d1aad641c6d3a5bfaa3bcf0abaeb79014140086a792f66448222ffc1 |
Hashes for pyAgrum-0.13.3-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0dd11560aca5d461ea4ec76b461cbafdccbac5a9b7367d12737086fea500d30f |
|
MD5 | 9c131b4e5f4d668808f81c81f5173fdf |
|
BLAKE2b-256 | aa97391b1d513d87e313bef9ee8d01082edfc2084bd9d04c16d6c39851937bb7 |
Hashes for pyAgrum-0.13.3-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07f14bd7ca1cf5aae9033489f4f915e44349d21b872429fdee4615bdb8c67559 |
|
MD5 | 6d702b780823bf2edcd2fd65d2a632bf |
|
BLAKE2b-256 | 8f59d8419a92b3247728def67b71589a5ebb360b9286ba7355a720b6c05091ee |
Hashes for pyAgrum-0.13.3-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 973d478b2698e45426e3416fada76d190a1b98da116df46ade2869fe373f8af2 |
|
MD5 | efc337466ed21d0dfb9a81276645a3ab |
|
BLAKE2b-256 | ac42e7bfd2b7ae25dc42973c6a61aae7a4bd7ac4138c3e4df848d63b158e9189 |
Hashes for pyAgrum-0.13.3-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e621a328f50c57b0b8b81e141cd6cb0f8c6cc25de5d35f0658e34c78265627c |
|
MD5 | f8c5026c176b50827737ecbe7e734048 |
|
BLAKE2b-256 | 4c330e5d88fad3ce587d88ddad8d5701af264f8410ac9a550bcfbb98d64fc0b1 |
Hashes for pyAgrum-0.13.3-cp35-cp35m-macosx_10_6_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f7fb26afecf07c1bd02c7cf192925821d9b206f67797df73566dd0b850e21ae |
|
MD5 | b595af01638ca0f0455b1c1c58f84423 |
|
BLAKE2b-256 | be72151ff9e3c50df3a1bf7f8e67c17beb41d67e15cf45b169df9c30cf4309ac |
Hashes for pyAgrum-0.13.3-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0addb6e8dfb96d972932cb0d2ae5f7d639fb398b26eaafc749fce1615d9e7de |
|
MD5 | d20c64e601ca0b45cc042427a010c10d |
|
BLAKE2b-256 | 3980cb8a7d8d232470f57967bffad908f17d2a0f6b8b057dc3d090d6de5cdf2e |
Hashes for pyAgrum-0.13.3-cp34-cp34m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a6f85a0159e6276e9d87bdf0023b54b4c1c8a6e51e48832a896200dd9eb0dd9 |
|
MD5 | 924ffee66c9fca9b5d7c4c4447fd739b |
|
BLAKE2b-256 | 23e86e071cf5d763bd308206c70cf77dd158c217a7f53193e7c5032c44b7dc48 |
Hashes for pyAgrum-0.13.3-cp34-cp34m-macosx_10_6_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2bf7923647f25d81a80ffd9faa42d63553e24da03a442a424a7e42e107d24abb |
|
MD5 | ccf0d550c2ac52a7ed51fc22d64120c7 |
|
BLAKE2b-256 | c9ebb58f2386f04ceae2af5935c468b0ba2e29812a5b01722064c701506d5627 |
Hashes for pyAgrum-0.13.3-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b496d5bf1fbc06daa20c71d0d804bc108166f159d9573ac664c1d71600aef87 |
|
MD5 | f7d0457b45643e52b021aefa791cd047 |
|
BLAKE2b-256 | 38a4747b2a62b6fb1677e5ca4fa7b85e3b27b129f503a8d1215c605c4ccc4404 |
Hashes for pyAgrum-0.13.3-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30f8dff5bf84cd95a2e22b57e75f155609cb87ee6ee47b4b6e976bc095602d99 |
|
MD5 | 720dc6d8d8c5d4633c67ef28868d1c87 |
|
BLAKE2b-256 | 2d52f1287e4f7b88bf0a1faeaa055ed88deff86d9bb834cfc6b7770b9f8e9e91 |
Hashes for pyAgrum-0.13.3-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e61550579e45f43488be2031e60343f79cdea0e57f7d19249f4187d3963e004f |
|
MD5 | 00f8ffd5425975d5cb027071fe9e7725 |
|
BLAKE2b-256 | 5b39cb5301b581720ec16dd79f4d5ee10e1175017b9cb60e0c2be6e366e0efd5 |
Hashes for pyAgrum-0.13.3-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8936dc8780af77e0ae4ed96776753f8b09a7df6d43bc3558596f6e3e5e07f0c |
|
MD5 | 086512d48494fe99fb8c2f0f7e974810 |
|
BLAKE2b-256 | cb32300dff442a33823d42f2234c7acb749a60eaf84c727170f47649ffe5f640 |
Hashes for pyAgrum-0.13.3-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6efbe08a987d9fe75790a0cdbb344b986bd0cece1ba24c52d2e4e591369e343c |
|
MD5 | 0df34ddd7a2227d81df66715eaa570a2 |
|
BLAKE2b-256 | 7d4dd4d9da947411c245ba37d077923a06dc4c0c9983620e530804c8ca966856 |
Hashes for pyAgrum-0.13.3-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c36c2ec76dae5fd94bcc0da41ccfd17ae624a1960d9d68b69e6d5ccbbe6ee738 |
|
MD5 | 6b44ea526e533be7c2d5ac32765347b3 |
|
BLAKE2b-256 | df80cc1575fa079d3ac07e58e9ead23d1f8b64328bf294114cf28d68db8c9a59 |
Hashes for pyAgrum-0.13.3-cp27-cp27m-macosx_10_6_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2315828848c871123de42e66b125d2bacb763c48cb248d85f48669ecb4a5dbbb |
|
MD5 | 152b8e6272b826e6094b8e4ff4dca832 |
|
BLAKE2b-256 | 1277f569a8c46dca4082b007cf23d27d9a3a9c7eb0057ff116d494166ff0b44a |