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.2-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c73832584e652f7ac47b6353ba6e9549d6f791a48814f7742a2a2fd2441af9de |
|
MD5 | d9d8911ab48fb48a20deee0e37886d4c |
|
BLAKE2b-256 | 2f7a516bce74c55cf3048b378dd06575b6372beee2561d8f8c62e3d7d1ca2fe7 |
Hashes for pyAgrum-0.14.2-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f908d7a437a05d717929f58bf9c7f183b761c3d0fe479dc86befbbe784c9b5d8 |
|
MD5 | 552d305da29f83831b2b990ea446a9d0 |
|
BLAKE2b-256 | c42021fa954baf3456b53f9743e7f86581d77025a01311b3489dfd7f7bdbaabb |
Hashes for pyAgrum-0.14.2-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba9301716b58e6363f05b1a4cb6052c56f570161d14f009f465e7769e5a484bf |
|
MD5 | fb0d9b63a454f8f905126a35e1ab7aaa |
|
BLAKE2b-256 | f5ea0ba5611a9790d9179a72c0333b4ec6f4380e450a2726a408c28e5b6851ef |
Hashes for pyAgrum-0.14.2-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3aa4989e89b9401f6f61df056811424f8baee2f9ed4bcd492ffb1b2281892d2 |
|
MD5 | 076a62a085da18252036214eff595ce3 |
|
BLAKE2b-256 | d391d5193f73cd213aaab9c8b60adb0790c246c8271606e434fe75661b48f557 |
Hashes for pyAgrum-0.14.2-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17e5a70a64c398dd7d53fc002304df16668e15588700ffe08fcef528b99be8fa |
|
MD5 | bf5365da71d23c1e884006df7e53f7f2 |
|
BLAKE2b-256 | fbc2dd77eda9b829c20f1d665b4f84445a7c2edbe1bfefa729c107bb8678563c |
Hashes for pyAgrum-0.14.2-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7baf4a5b1ad15ad5b51d68841f7482e89d3261079abb188952daac4bb3ebc61 |
|
MD5 | d2975b1d2562be631b61ba6dbfe7714d |
|
BLAKE2b-256 | 557ce75d59890aa15d89ff171d67db4cc619360c812ed3d0ac190ae3746de61c |
Hashes for pyAgrum-0.14.2-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d74bc3f79d4735beb467630b3920f6dc766d58ae14d971869694646069975c9 |
|
MD5 | 76cb8455ef0c9aa9c9ecfe30731cd959 |
|
BLAKE2b-256 | 4b7fedc5da6d579170fb2dcdf7129fca9c027671e6832ab132188806f1937f60 |
Hashes for pyAgrum-0.14.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85e049b1cb82e4fe8cdeca6c4b9f53b4f18dbca1b72423f6f2983b6b566862a7 |
|
MD5 | 50b07147462c180142e7bc55f82dc62f |
|
BLAKE2b-256 | 9bbbaf59f04728b7eb96a226bb9563ad9fa79bd1dfc0739a11e660fa83daa8f3 |
Hashes for pyAgrum-0.14.2-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4aa67bfa46cd097fcd33a6c1bec49d9e4e0c376dbef06997a3960e44efaf63d7 |
|
MD5 | 4a4f9fb5f23d825c4e26bc51d2c62119 |
|
BLAKE2b-256 | 7153231bab7bbc37637673cca9fd912994d48f5461eab90b95628ea701430230 |
Hashes for pyAgrum-0.14.2-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b65414fdd2fe0adf24035dda73cd104a093eced66a3557b4e144409d87e6171f |
|
MD5 | 893ec6e89514c64d2884de7bfb4e628e |
|
BLAKE2b-256 | c3d1939c45dca6b39c172cd1abef22c2932c8bea2e16bedcdc551d51930712a5 |
Hashes for pyAgrum-0.14.2-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 578cf94a76bfa39ad0826358f3acff49403f8eae7213d8e31d8ec6bb857662f3 |
|
MD5 | 0845ea3a74e78faec332fc7f7341487b |
|
BLAKE2b-256 | cb545ea94343cc41cadb1804aa64bd0459c0520d9f3894f894be4ba9c30753ed |
Hashes for pyAgrum-0.14.2-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf497c1d093d0aea77aa5154b49700490896acbaa34bbf31f093a4a3bdfa78b1 |
|
MD5 | 5a279f575c7b7bab06f85a29ec6ce47f |
|
BLAKE2b-256 | 36c10051bfaaafdbda973125dca5de1eeae2b28143c71221c47e3e8cca871f53 |
Hashes for pyAgrum-0.14.2-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91f2a273f44444cf5f34ff033b911d6515b870126ef318b996fc2b14c3137eac |
|
MD5 | c973a12305c2930b43970d65a35a937f |
|
BLAKE2b-256 | a7b026b94896622b940905fcbce5fa52eb6a4ec4fef9013b947d1da18d151431 |
Hashes for pyAgrum-0.14.2-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf8ad3e63f8e66ff8a1736db86722bc8585d0cd477fd601851e63232a748da3f |
|
MD5 | 63aa69c284ce1a1f9ba4447b2d082f5b |
|
BLAKE2b-256 | 34028a7d816637d0d92423ca0b58f3cd5a888aaccd99511c4aba6808d9981fa5 |
Hashes for pyAgrum-0.14.2-cp35-cp35m-macosx_10_6_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43ccd090bfdbbd625316a490225f247b90d74fb46607f8f9b1f74550fddab6d1 |
|
MD5 | 2917e48140f4e4b32b548055e335627a |
|
BLAKE2b-256 | 88ccbd03247800ef10ee51fc4ebee6d02e9c3495488df3e3b66c1d70708c8347 |
Hashes for pyAgrum-0.14.2-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d110d347ca572d0deedf41c062760fe892ddad614058c83fa8cbf5a9982bfdee |
|
MD5 | c7ef8c0619eda7ba4a32c5fba4d9fb2d |
|
BLAKE2b-256 | 5c379d9fb94ab5d61447926f594422083c73ca00b917b759e6b00bc8c01363e8 |
Hashes for pyAgrum-0.14.2-cp34-cp34m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 899c9c0ce8d55abcbae9d72aa9612a280865a19ca5c83c40713ed788c3523b14 |
|
MD5 | e078881a1e5165a7e3ac98486e90c16c |
|
BLAKE2b-256 | 7f5ecf860a9713af26f7b01ba8103ae5e6160260818227900a10741dab0a28d9 |
Hashes for pyAgrum-0.14.2-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 806034f7b68c82111c7b22524b3f136cf353c3c4ea355e8e1b0fb9492e1b8d43 |
|
MD5 | e9e7732d99bb060d6b69a2322be944d0 |
|
BLAKE2b-256 | 7ea9b7d59a99c9db83dbb362b685372425f31b0d75e4a575ec2d01bdc23a71ec |
Hashes for pyAgrum-0.14.2-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04dbece8c91b824f88e8c3fb9680c2abb9c655fbf5d210869d7b6820f3603ed2 |
|
MD5 | ce90773b16180929ea9faaebc48a44eb |
|
BLAKE2b-256 | ccb4b8f66bb6d54a22b063a0c3f5e111ca85d76f3bb766247d5167ba43066af9 |
Hashes for pyAgrum-0.14.2-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae7b5d2d82658e4a2e92ca063ae766b4b748576f991ed015f92510e2a92a2e34 |
|
MD5 | c4e43af10b7a5a8540537dace0d9a5e5 |
|
BLAKE2b-256 | 8215236f4bac765c1bee4117f52f965f3df236b2aa703813282e13320cd608e6 |
Hashes for pyAgrum-0.14.2-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0274f01fb12093de2b6db0ba1d296ea736eafa9a6c2b4d1774e8f6639e608f5a |
|
MD5 | cf837c23dc5fc2f4a3ad38e9f0d44f11 |
|
BLAKE2b-256 | 65a8f9d79d7d1998100c523669e0a06f9759b989a6a3d70afeac42f1bc5e15d7 |
Hashes for pyAgrum-0.14.2-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e885ea67a8a9a79581b6c4311070f72204bb54dea58a3459aac03a31910909c7 |
|
MD5 | 9825bc47baf1956717a24b5bf50ab267 |
|
BLAKE2b-256 | eef0caccea3a306ce4ca87f1ab0516633a829ebf719401f0293a87415eb0e828 |
Hashes for pyAgrum-0.14.2-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08ec6b7a8674b20d979d909109362ba727f44d14c7625bada023c696d5e342ec |
|
MD5 | 4d150aac7d528b0932b79356f2a49e2a |
|
BLAKE2b-256 | a62042cb2537afa5b89b8c775ad9d9f8d53343e54975b309fa0292e32f817e1b |
Hashes for pyAgrum-0.14.2-cp27-cp27m-macosx_10_6_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7035099e13fa23d6a34f6ae67d60be48ddb168d81c821710bcdb70288d936f29 |
|
MD5 | 07cee48ebabc456698c1d4ddd9c741c9 |
|
BLAKE2b-256 | e22d67f43e2545dad9fe627e9e0c82d6fd740e0f2fe9e64f0693d90df0e3037d |