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.3-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0c2436d374c440f3f26b558abdd801015c0efbe80e6d31f04e51391a2a8dec9 |
|
MD5 | b40a2a36a7e59d1479692b4b1be41e8e |
|
BLAKE2b-256 | 0b279a78f7716a02286decdadb4fca664434006e21fbcb0c025d78cdfe2c6626 |
Hashes for pyAgrum-0.12.0.3-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1310cebf9bfb4617248dcdef8c06e4546e6137c896f92fb002c03d1741745e8 |
|
MD5 | 723169f7e2331d6615aed87c4cc1fb3f |
|
BLAKE2b-256 | 2f062c59170ea416c6784fa572a2c877f82ecbe65efbead5242f98db063d36a6 |
Hashes for pyAgrum-0.12.0.3-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e787204d4bf1b6e272d01095f2ec70706107b99cd7faa9a529a07570faa7717c |
|
MD5 | cd237eb4ad1627d67a0d8b5e5243d1a0 |
|
BLAKE2b-256 | 6c2653bd3242e4f28d8520a0b8ed9ce5704030af98c8548fdc6e0678c3720777 |
Hashes for pyAgrum-0.12.0.3-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1583b3434fbbf7ead4684131dfca4f6e3017eaaa60ba571374517c62f9b85462 |
|
MD5 | df28df018ec57b8e1706382ce01e76f3 |
|
BLAKE2b-256 | ec45716908a5c4b4f0a28119c2fad33a3ed7fae7c4bcb2e17a3b0d2dc09ee689 |
Hashes for pyAgrum-0.12.0.3-cp36-cp36m-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e310fd1ef2095371e4a7392b2fc6394b3b309845413a5d028b2c2e1286316bfa |
|
MD5 | e67f0832a8b407336ce9652c4cb31ec3 |
|
BLAKE2b-256 | 958b0a2db6a653528b6b2eb578affb2fb627b181078a269129d84633ac008e2c |
Hashes for pyAgrum-0.12.0.3-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c97cbcc7de5607228d2edd47f8cd1da45e7be26fa85770c95cc711c5eeab3ed |
|
MD5 | 89a183d40449da86c893186ebc7b607c |
|
BLAKE2b-256 | 7f63d69cce0f54b9ec09c2e06c3e913861650ee42039166dd0c869e1cd497eb4 |
Hashes for pyAgrum-0.12.0.3-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a77c43653ba43f899817a90bcbbb2a4c2599b0f0a7dbbeab93c395e37cf69d23 |
|
MD5 | 76a8bf0cd26ac748887884e175ceb76f |
|
BLAKE2b-256 | b36bb22d9ddf87b34bbf33e0caa3d2905e9b681a6c296de9d1ebe837a6687664 |
Hashes for pyAgrum-0.12.0.3-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b677cd937eea3079ef2e9aae6d7d4c64e01f712ee4df32720a970e408b6ac88 |
|
MD5 | 27fbb23a620442c79d63d25a9f9ab222 |
|
BLAKE2b-256 | 9f78a0a0caea7bcf6d363c3c4b511456dae6bbda528b3927f5ff65ae1c31b0a1 |
Hashes for pyAgrum-0.12.0.3-cp34-cp34m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42a9580e54c9d8880c3563b29492e5bd757b1c0610176b443f86f55d0744a66f |
|
MD5 | 85a8d1f75ba0ad1f3d71a6289aa23872 |
|
BLAKE2b-256 | 61c50ebe37a707169b201416eae58f3c0eae3783fb64eab65de45f5ca3d5a823 |
Hashes for pyAgrum-0.12.0.3-cp33-cp33m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a328c1a24b4f8bf5474d472ffbfb8cc9bcaa1226c1e091ae8a301cd3216a5fc |
|
MD5 | 46ec87258ee12b3395d794d488d008b8 |
|
BLAKE2b-256 | d187c0d865d1a21088b7af0be566068cd97e2043d061c27efcdb1a0dab7b110a |
Hashes for pyAgrum-0.12.0.3-cp33-cp33m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30c3e2b833d7351b2df545c0bf9f102a85b60abb12b377bc9583145ae65c1702 |
|
MD5 | a6e24dd3ae1c13ddaefcbbc205e12eac |
|
BLAKE2b-256 | 450b8092bd847045362e840e07d9c884a44e98d501d4305c358bdc480bfffe44 |
Hashes for pyAgrum-0.12.0.3-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21d8f6b7f79bae7542443acbfd0562e2f5f1ef25f509adc61f1e680df39babb8 |
|
MD5 | 51031179a9b84c1af138b7f88894164b |
|
BLAKE2b-256 | 56d6bbe08958b62a16b9ee8ba1ff73b2501fe746727952291f840b8cc383bd2d |
Hashes for pyAgrum-0.12.0.3-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31473a90cdf7df98fc2d9c1da95fe719fc93f750b26ab61502c9e5de51845e20 |
|
MD5 | 552b869ccf43c448df8a0ef40b6f0f15 |
|
BLAKE2b-256 | 696231b233684fde092b64e0e655ea673e8d9698fbef53dec861b71a74f429e1 |
Hashes for pyAgrum-0.12.0.3-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e2c330bd57065188c28e4918fdf85c1ee7fd7189895f285ca0da83541ab2288 |
|
MD5 | 97d353ad6ec6293619f49116df626e59 |
|
BLAKE2b-256 | 1ba11cdc529e203df7d5810be54d507b214ce3a2721bbdd8c88e4f339c02686b |
Hashes for pyAgrum-0.12.0.3-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad66be847001b23ef569db32dcc44b4d0e836f0df2e25742c412defe4ce55558 |
|
MD5 | ed0c02256f286173799e46d16c5615b1 |
|
BLAKE2b-256 | 46ea732fa716a94e3a49f282b05c4e0bd9f604d754e16a48b3f5a40338b3c143 |
Hashes for pyAgrum-0.12.0.3-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95fb80fb91a0702735c90fb24c75a3690607f0e53fbd77228b81d2a674bad5e6 |
|
MD5 | de6a4cc88f71e9f9880caf3cb5f36256 |
|
BLAKE2b-256 | 4abfc7fdd0bf261c85da4996d887de4eb493b7b83f26e51bc3cb76b175fb735e |
Hashes for pyAgrum-0.12.0.3-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e490623f96b208edea5d41dec4d76383dc291c99fc6ccafdc5e66b315d84b1e |
|
MD5 | f6a75ec8b866e437c24a50521d60f545 |
|
BLAKE2b-256 | 76f05ec3fe24d2ca3df0915de5ba043b271e96fc20f16d54e86b70aa8f5e61cf |
Hashes for pyAgrum-0.12.0.3-cp27-cp27m-macosx_10_12_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de9f9637becd6cdd8a06fe0c4dcd69b2a468e4bf8cff4dc622f202583db34d58 |
|
MD5 | a97cd47d5f6c542d1c8cb107a00e1825 |
|
BLAKE2b-256 | 6a49b9a2fa42af9cede97f0b2c0386841abde5575c5cf61e2c1af98a0b46f74c |