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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyAgrum-0.13.0.1-cp36-cp36m-win_amd64.whl.
File metadata
- Download URL: pyAgrum-0.13.0.1-cp36-cp36m-win_amd64.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.6m, Windows x86-64
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7922e60210178a1f32dfedf032473df8f91c557000f8b3b9963fa95b575df60
|
|
| MD5 |
bcedac20e43bab7642c4462b9fc2e11b
|
|
| BLAKE2b-256 |
6ad8931c867576f2da854b4d318d92aa8dd76d8df81b4df1c70b0c38d87ea25d
|
File details
Details for the file pyAgrum-0.13.0.1-cp36-cp36m-win32.whl.
File metadata
- Download URL: pyAgrum-0.13.0.1-cp36-cp36m-win32.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.6m, Windows x86
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94eeeabbe79a140f20276a2a780f809f62aa20ce9ec86fd1f77e5078e208d88b
|
|
| MD5 |
ebb4981ef9053f9cf788119d310c4c54
|
|
| BLAKE2b-256 |
f61d8681622016dba6879a4e943fca22576b5825074c1d5e475d0250e9775b7d
|
File details
Details for the file pyAgrum-0.13.0.1-cp36-cp36m-manylinux1_x86_64.whl.
File metadata
- Download URL: pyAgrum-0.13.0.1-cp36-cp36m-manylinux1_x86_64.whl
- Upload date:
- Size: 12.6 MB
- Tags: CPython 3.6m
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7ee3e91cadbff5d63c543d4f01772f2bea33659f680688f1bce7930a074dc7a
|
|
| MD5 |
ba8c173f1da2997e897de3f2adf5a714
|
|
| BLAKE2b-256 |
a069cc19c90d0d8d8f479ed466a2b675e1e824fc675139306683e70312f7539f
|
File details
Details for the file pyAgrum-0.13.0.1-cp36-cp36m-manylinux1_i686.whl.
File metadata
- Download URL: pyAgrum-0.13.0.1-cp36-cp36m-manylinux1_i686.whl
- Upload date:
- Size: 12.1 MB
- Tags: CPython 3.6m
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2868ecb0a47a3e452dbb27bcabb3cc1b0a8cf1d31b0db6d69097865cf04d6097
|
|
| MD5 |
52938ca8f53274edef34e9c1e43467b9
|
|
| BLAKE2b-256 |
0c198b069d740d9a67290b1962862bf31764017216f944757e9f9703d93457d4
|
File details
Details for the file pyAgrum-0.13.0.1-cp36-cp36m-macosx_10_13_x86_64.whl.
File metadata
- Download URL: pyAgrum-0.13.0.1-cp36-cp36m-macosx_10_13_x86_64.whl
- Upload date:
- Size: 3.8 MB
- Tags: CPython 3.6m, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cac86513fc0f4dd10bf928f867abdb7048daef37a2e856fe4a6377bc418ef43c
|
|
| MD5 |
69d4464145f055878884d3368e38639d
|
|
| BLAKE2b-256 |
d531ad16574bb8f5892843a0410bef022ce0004fcf1543c7c4d58585bb136a91
|
File details
Details for the file pyAgrum-0.13.0.1-cp35-cp35m-manylinux1_x86_64.whl.
File metadata
- Download URL: pyAgrum-0.13.0.1-cp35-cp35m-manylinux1_x86_64.whl
- Upload date:
- Size: 12.6 MB
- Tags: CPython 3.5m
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68bb2c4e3840c2449d87335778d8ea529cf076922cec887501f3d06eb9177c88
|
|
| MD5 |
44ea8c7a35cb0b5628e0ac2d3f10519a
|
|
| BLAKE2b-256 |
b4ba67278198ef22c3d6da0daad7ae03d67299cabbc318394f4b7ecd6ac42919
|
File details
Details for the file pyAgrum-0.13.0.1-cp35-cp35m-manylinux1_i686.whl.
File metadata
- Download URL: pyAgrum-0.13.0.1-cp35-cp35m-manylinux1_i686.whl
- Upload date:
- Size: 12.1 MB
- Tags: CPython 3.5m
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
489ab440e7e71cb96358b5ab2072f0419d39a52b6929a65052ff6f418d122588
|
|
| MD5 |
0c19db7e0854e35a205a91da51994d07
|
|
| BLAKE2b-256 |
45ebcf1cf1ed35b7b9366e13467813eed41f2ed3ae5884425c7a98799f03eb7a
|
File details
Details for the file pyAgrum-0.13.0.1-cp34-cp34m-manylinux1_x86_64.whl.
File metadata
- Download URL: pyAgrum-0.13.0.1-cp34-cp34m-manylinux1_x86_64.whl
- Upload date:
- Size: 12.6 MB
- Tags: CPython 3.4m
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be99c2fa47810c902af4218f4b3e2efda2431db60726a2d9f1d9c93b49319a15
|
|
| MD5 |
ac0613136ff04ca847c61e495c689162
|
|
| BLAKE2b-256 |
ba43362f3f3a1133f5ba5f4ea7a91d00f1b6c58d6b8e2a26392d29f919a68606
|
File details
Details for the file pyAgrum-0.13.0.1-cp34-cp34m-manylinux1_i686.whl.
File metadata
- Download URL: pyAgrum-0.13.0.1-cp34-cp34m-manylinux1_i686.whl
- Upload date:
- Size: 12.1 MB
- Tags: CPython 3.4m
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d64ac38a00b06b78ac59ad2b839d97fc9cf68b7f49a8723aa5a613d4aab19222
|
|
| MD5 |
7346a2d3231c3f66bfbbc9ea44320518
|
|
| BLAKE2b-256 |
6a904a61d2f5f3612fa95ba97a44da7a848c0b5cfa36479063fa703e6d695b08
|
File details
Details for the file pyAgrum-0.13.0.1-cp33-cp33m-manylinux1_x86_64.whl.
File metadata
- Download URL: pyAgrum-0.13.0.1-cp33-cp33m-manylinux1_x86_64.whl
- Upload date:
- Size: 12.6 MB
- Tags: CPython 3.3m
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
769177dd328c0c2cbcbb4bca13d3df078d2f015ee03eea4627fa35796d3d3748
|
|
| MD5 |
bb8e787b424cfd11d42430bb2b8edea5
|
|
| BLAKE2b-256 |
4134040357a6b3b2c38338d9851b515cf0a6d220f055276a9c8ca28e9453fc29
|
File details
Details for the file pyAgrum-0.13.0.1-cp33-cp33m-manylinux1_i686.whl.
File metadata
- Download URL: pyAgrum-0.13.0.1-cp33-cp33m-manylinux1_i686.whl
- Upload date:
- Size: 12.1 MB
- Tags: CPython 3.3m
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37b195f98a22fe541ef377722c822e8e0bbebab1872d8fded74157934f9b18e5
|
|
| MD5 |
7460643bae2e3d083d4957d9535152ee
|
|
| BLAKE2b-256 |
cc2410bd1d6eeb8e23e3723f26c0125bca2f88eb29c6ac48f846d311478548ea
|
File details
Details for the file pyAgrum-0.13.0.1-cp27-cp27mu-manylinux1_x86_64.whl.
File metadata
- Download URL: pyAgrum-0.13.0.1-cp27-cp27mu-manylinux1_x86_64.whl
- Upload date:
- Size: 12.6 MB
- Tags: CPython 2.7mu
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d66245465c7c8a34492e685d47f29dc3b0de6d594f84e6a748d105b0759711c
|
|
| MD5 |
8512453a4e1d92570470f05a7e5c16c3
|
|
| BLAKE2b-256 |
e63ce3af2fb34dc3ecca9723e951ae5875f1aefaf0a924f82a18db480afe5478
|
File details
Details for the file pyAgrum-0.13.0.1-cp27-cp27mu-manylinux1_i686.whl.
File metadata
- Download URL: pyAgrum-0.13.0.1-cp27-cp27mu-manylinux1_i686.whl
- Upload date:
- Size: 12.1 MB
- Tags: CPython 2.7mu
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d6868e27d6c9c94bb777d547de8fd09b8a76ed92a95fc231e8fb747a0d32770
|
|
| MD5 |
2afd69703ab692e3c651565b6c81dd59
|
|
| BLAKE2b-256 |
cf2cbebd3f2df6bb97604fe7ef5a02bad50135d77ab2bf5de39305a3cc44467f
|
File details
Details for the file pyAgrum-0.13.0.1-cp27-cp27m-win_amd64.whl.
File metadata
- Download URL: pyAgrum-0.13.0.1-cp27-cp27m-win_amd64.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 2.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40677fde98ca85a04540608a1cf4d8cc0bfce599bbbf9a80c81fcbf238dacee0
|
|
| MD5 |
ccb0ced3157c1282635edc9597a91783
|
|
| BLAKE2b-256 |
e05c22acb6e16edfa5fc9786fde720a248c015aec3b8228fb01c52af2fce0bfa
|
File details
Details for the file pyAgrum-0.13.0.1-cp27-cp27m-win32.whl.
File metadata
- Download URL: pyAgrum-0.13.0.1-cp27-cp27m-win32.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 2.7m, Windows x86
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a44a6c486527b8c183a9bb54984efdb59cf8cb4e6d695bf9efed823040bbe16
|
|
| MD5 |
01abf2c2f2538d13c9767bbb28a8771d
|
|
| BLAKE2b-256 |
efbff7b6cb1524d2e1e7c6683810c659fd2c71992a6513ae81affc700a5f153c
|
File details
Details for the file pyAgrum-0.13.0.1-cp27-cp27m-manylinux1_x86_64.whl.
File metadata
- Download URL: pyAgrum-0.13.0.1-cp27-cp27m-manylinux1_x86_64.whl
- Upload date:
- Size: 12.5 MB
- Tags: CPython 2.7m
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3364a4b15decb6cd1f9f5d3c73d48f6c697560cc92df51d09c880a8f60b4480f
|
|
| MD5 |
ab41389b2ad0df97e8e1316f013cdf80
|
|
| BLAKE2b-256 |
2c29d0022f584b03424de59c5abb89702c31a3aab71c5d7fb523071faea16934
|
File details
Details for the file pyAgrum-0.13.0.1-cp27-cp27m-manylinux1_i686.whl.
File metadata
- Download URL: pyAgrum-0.13.0.1-cp27-cp27m-manylinux1_i686.whl
- Upload date:
- Size: 12.1 MB
- Tags: CPython 2.7m
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eaf059073eca6b3b25f44a7e13aea4a42a619f35824d9e324ef471939b11ae16
|
|
| MD5 |
6ca5cd830cd04749216434a8029df3e4
|
|
| BLAKE2b-256 |
0c32ea1d83c62386ffad0fa3b23cbe7e5a8e173b8a2714481a27f9a83f87ea5b
|
File details
Details for the file pyAgrum-0.13.0.1-cp27-cp27m-macosx_10_13_intel.whl.
File metadata
- Download URL: pyAgrum-0.13.0.1-cp27-cp27m-macosx_10_13_intel.whl
- Upload date:
- Size: 3.8 MB
- Tags: CPython 2.7m, macOS 10.13+ Intel (x86-64, i386)
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4e84db0da2531f8bbd2a001129aa3027605625cfd27dddcd863f882bbdefe1b
|
|
| MD5 |
2d201dea94c6a4b1ae746583c275d8a1
|
|
| BLAKE2b-256 |
b39a289c98c1db1f802eb38e1bd08a492e5226a1427ef5f5f9786be80f42f461
|