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.6-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9643e9cc886eee4f5380199b112768740d69575381bf0df9243d02e383fc407 |
|
MD5 | 80d8ae08d4d699885c24dddfbf228627 |
|
BLAKE2b-256 | dee7f635ca29cbe46dc7fd745e9a17570958aff4c20ff0f608507c897430fd76 |
Hashes for pyAgrum-0.13.6-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a58be63fccf89ce7b6354d8da11562765755687f809f68f3610d32a6e40c0d3 |
|
MD5 | 548bfe0fedf8115d1c537d0044fa0c96 |
|
BLAKE2b-256 | 7459ab3d0f56e72e3864ce7545e997e2f9d13a2652b2d10a0dd45c0583c777c9 |
Hashes for pyAgrum-0.13.6-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64dc895b2e91afc9105b1344948b76ba427fa836b1aa5bf179a2bfe0a849e54b |
|
MD5 | c67b644b9a6e8ad4d93bb929b2ac5a81 |
|
BLAKE2b-256 | 578f05bd258d32b9b2df21fe776933cb5274668b63230ecee16caae3174844d1 |
Hashes for pyAgrum-0.13.6-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b735a92d81d8d4132b9f27f50f16bf7ab2cdb148f391a208d213c9bd6be4bd4f |
|
MD5 | 162444761727c4ca379eeefa15fcb297 |
|
BLAKE2b-256 | abf69647d2f243b3c39b17df5ba3cbd57724f66351ffce5391a9eb1f2b87fb45 |
Hashes for pyAgrum-0.13.6-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | caffe436e2fd35d1380c0eeadcaec6393178efc21ef18f5e7f50bfeab7626d8a |
|
MD5 | 1017e690d5f68d25f0ecd8f935299338 |
|
BLAKE2b-256 | 3b558d998d41f61b4842f9fe51391bc081e3653544bd57f0549601b92ed365c8 |
Hashes for pyAgrum-0.13.6-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f5b0c4053a95218a7f934776e3a8fffae435a116fe91205bab0747f76e4706b |
|
MD5 | 209864986fec8ed0aa99187997406718 |
|
BLAKE2b-256 | 5744a36a66d4b996c3f4da8c5cab8ef0a5a8a1195abbedfd9b17d88e0bed5e88 |
Hashes for pyAgrum-0.13.6-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74aed735a50687f0019c25f063973e75338fba6745cd0282be7951c72483a3ca |
|
MD5 | 7c0eb05012d108dafce3dcc8527b4d6c |
|
BLAKE2b-256 | be5a8b7a7a105a1e4370890b50944809baee0b6f8656463b79560c8063c0f6d7 |
Hashes for pyAgrum-0.13.6-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5de9724fe1568ae158fae114ccf18481286913fa42d28bb62a24fb6fe6166dd |
|
MD5 | 71bcc4adbbed12745133f3873607e5dc |
|
BLAKE2b-256 | 2054d48b52acb1a954bb33b1ece3e706acb572f93ed703899eb36742ac36a309 |
Hashes for pyAgrum-0.13.6-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb4712537c127511ef7d0922b0dcfaaeac329769b71e47e2fe0bbf9bde5bc8bf |
|
MD5 | f161009495e5fefbd341ac4f42ce5fcb |
|
BLAKE2b-256 | 4775f657bcd5010ab91c15441213f8e9ce7d2022a4f77ee43546b5d5ae157e33 |
Hashes for pyAgrum-0.13.6-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 272bef48a512e8a8381b46699daa601354f7608bea8399543d5743c94aba7741 |
|
MD5 | 1ec1fad7fb037ec12329330840d09b80 |
|
BLAKE2b-256 | c73ceb789db57732270736a3328ba6d4d7bf7ad8bc74ed24b57fac84d779dbaf |
Hashes for pyAgrum-0.13.6-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b57fccfa80afd47bf18717332b7cc5e385e91d4ddc932d6f765c1523c0415f9 |
|
MD5 | 7a253db352bc6d06c75cfc115ad550b8 |
|
BLAKE2b-256 | b36da3ea574af7c59e7e6c7884b3e1baeefa28679c543531700211e24ff96375 |
Hashes for pyAgrum-0.13.6-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f4e91942fd98c8e7ac1337cb4c5fa18d97395a6b531f26f225508c239b1b42e |
|
MD5 | 2a68a60addfb183a4ef608d3524bbd58 |
|
BLAKE2b-256 | a48517b6f82fd5a6d0f08f8a904f2e26fb6bb254afc690fba1f9adae639ff34b |
Hashes for pyAgrum-0.13.6-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3eb0e8f1694f9ba2220c484eb56f9ae755443525116f93a11669f5822726d77e |
|
MD5 | aaebfdab08b105610e69f8d99a4ed527 |
|
BLAKE2b-256 | cefa895bd836e63b1b79e3f68c597eb69328da3379e169188e8b3907187d8ab3 |
Hashes for pyAgrum-0.13.6-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5030c2fd0c3acffdda0500c1bad90324aaeac55304ec8bd80d8b7a15e5d4285 |
|
MD5 | e50a7f6988d0bf6dc73f6c69638fbea4 |
|
BLAKE2b-256 | 428ff5ee2a8272aa72f4b646a6d88d772529c9b42d2fcdc59c18fa3cc9e8cd04 |
Hashes for pyAgrum-0.13.6-cp35-cp35m-macosx_10_6_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0ff1962b840384fee90bc4699ff1f75edfa8779f949dd07a950d559d7cdc9ec |
|
MD5 | 764520fde167d870755f5c4216e628cb |
|
BLAKE2b-256 | ec0500efdf6cab26007179a35f223dd33da7117ec6b6d424a06723dd896a48fc |
Hashes for pyAgrum-0.13.6-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c5fd09cf14218a39c36c8aad0f52d9b2ca6e6931d8d1aff84df4fdb46c9a9bc |
|
MD5 | a6c01e18224748e15f1a0a8e7c053258 |
|
BLAKE2b-256 | 49d1ace9d200c45745da961d8291fc8e2bc8573d203c00d5f763c685be927eab |
Hashes for pyAgrum-0.13.6-cp34-cp34m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 289a6a5bf371ce52eb2babc2a8fc93b1b813d7e62880f7ce83fcfcc220c786d0 |
|
MD5 | e377316952232006150bad3f172d2158 |
|
BLAKE2b-256 | 480b5032695e159621545e72d2cb060398cb6cb54311c3fbfebf01f48fa29541 |
Hashes for pyAgrum-0.13.6-cp34-cp34m-macosx_10_6_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | feab7f0e38c2b77566dd4cb5382b9de38f024248f9eed9a114d14f59a1b632d2 |
|
MD5 | 3ec6e2076d531646e5192ddf0a53278c |
|
BLAKE2b-256 | 21e3d562e721c7900091fd97c31043c2905176018da52f38a6ccf818fb9e0c14 |
Hashes for pyAgrum-0.13.6-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f14d35247b58ee21dd987d5b5d652a841d4ac40b0f5d65fa8d67e6b64f4f6d93 |
|
MD5 | dcf1e924b5ff64d00826d1ea74eca918 |
|
BLAKE2b-256 | 31c398f1e88a62d2125b93df8e3f5134a6efcd56324410bad746c0877985c30e |
Hashes for pyAgrum-0.13.6-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7dd5b977eae00dc95f2ef83b8f5d5a9049eddfcb67deaf809ec7d427498c9598 |
|
MD5 | 41c00d14c27385de462a5f2c3b9450d6 |
|
BLAKE2b-256 | 6f2e61d9f6645f78b3d3a77b244fa35ccd1c23c9567bca43715667508a71b5f5 |
Hashes for pyAgrum-0.13.6-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f73fd5dfb18d4b5e328fa4ece6d1a7bb154dd70dd49c18225f6460c181091e24 |
|
MD5 | 742b3010c8e4c5b052bbdd95df018b90 |
|
BLAKE2b-256 | 0918d06e4ce9b0a84623c20131d2328a1fb82f449b6e6e96cd485193d0fd2886 |
Hashes for pyAgrum-0.13.6-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 801f549ba9d9fa963ae25701379f9e893bee53129eb42741370da8605386dae9 |
|
MD5 | 1f02f3b31121aadf5312c23adcfccaea |
|
BLAKE2b-256 | 4baa0af93091dbb10850e77e5c6c8708676db74cf8a21e785d96d01cd74c29dc |
Hashes for pyAgrum-0.13.6-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8e14cb91bf4bb0294202d6878cff33e0b2aa54f14bf967b5c410071e6afcd39 |
|
MD5 | a7628ea216c7b3d92e04903d2d5ea35b |
|
BLAKE2b-256 | d5b0e15544b3d63de41f1760e861522c03c42cc748c6464d2333a90d8263bad1 |
Hashes for pyAgrum-0.13.6-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9687cc381bdcda3d70cc5ae97af492a407db6a7245a2f52f92b409affccf9d1f |
|
MD5 | 6fdc9451a77792d20bea7ac11b96b159 |
|
BLAKE2b-256 | bd0740fa1a2dee30ba77233769d96dca9cc39b48d28aa931acc0966202aeb313 |
Hashes for pyAgrum-0.13.6-cp27-cp27m-macosx_10_6_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8585d5ee419ba6ea77107002ce6f6a8a653db2be5eaa5b0bc008e54ccea44b2 |
|
MD5 | f15f1e347ca11514fd02291eef63b938 |
|
BLAKE2b-256 | 23f2195473a32a815b9222318f1f4ab6fa1127e1cba3ba6490155de6fa5f5c4b |