Skip to main content

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.

Authors

  • Pierre-Henri Wuillemin

  • Christophe Gonzales

Maintainers

  • Lionel Torti

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

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyAgrum-0.13.1.1-cp36-cp36m-win_amd64.whl (2.3 MB view details)

Uploaded CPython 3.6mWindows x86-64

pyAgrum-0.13.1.1-cp36-cp36m-win32.whl (1.7 MB view details)

Uploaded CPython 3.6mWindows x86

pyAgrum-0.13.1.1-cp36-cp36m-manylinux1_x86_64.whl (12.6 MB view details)

Uploaded CPython 3.6m

pyAgrum-0.13.1.1-cp36-cp36m-manylinux1_i686.whl (12.1 MB view details)

Uploaded CPython 3.6m

pyAgrum-0.13.1.1-cp36-cp36m-macosx_10_13_x86_64.whl (3.8 MB view details)

Uploaded CPython 3.6mmacOS 10.13+ x86-64

pyAgrum-0.13.1.1-cp35-cp35m-manylinux1_x86_64.whl (12.6 MB view details)

Uploaded CPython 3.5m

pyAgrum-0.13.1.1-cp35-cp35m-manylinux1_i686.whl (12.1 MB view details)

Uploaded CPython 3.5m

pyAgrum-0.13.1.1-cp34-cp34m-manylinux1_x86_64.whl (12.6 MB view details)

Uploaded CPython 3.4m

pyAgrum-0.13.1.1-cp34-cp34m-manylinux1_i686.whl (12.1 MB view details)

Uploaded CPython 3.4m

pyAgrum-0.13.1.1-cp33-cp33m-manylinux1_x86_64.whl (12.6 MB view details)

Uploaded CPython 3.3m

pyAgrum-0.13.1.1-cp33-cp33m-manylinux1_i686.whl (12.1 MB view details)

Uploaded CPython 3.3m

pyAgrum-0.13.1.1-cp27-cp27mu-manylinux1_x86_64.whl (12.6 MB view details)

Uploaded CPython 2.7mu

pyAgrum-0.13.1.1-cp27-cp27mu-manylinux1_i686.whl (12.1 MB view details)

Uploaded CPython 2.7mu

pyAgrum-0.13.1.1-cp27-cp27m-win_amd64.whl (2.3 MB view details)

Uploaded CPython 2.7mWindows x86-64

pyAgrum-0.13.1.1-cp27-cp27m-win32.whl (1.7 MB view details)

Uploaded CPython 2.7mWindows x86

pyAgrum-0.13.1.1-cp27-cp27m-manylinux1_x86_64.whl (12.5 MB view details)

Uploaded CPython 2.7m

pyAgrum-0.13.1.1-cp27-cp27m-manylinux1_i686.whl (12.1 MB view details)

Uploaded CPython 2.7m

pyAgrum-0.13.1.1-cp27-cp27m-macosx_10_13_intel.whl (3.8 MB view details)

Uploaded CPython 2.7mmacOS 10.13+ Intel (x86-64, i386)

File details

Details for the file pyAgrum-0.13.1.1-cp36-cp36m-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum-0.13.1.1-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 94feae06a2e129f712479bbaa0e021cb915213f3bba5d06c63e002977287d020
MD5 f47cddb44792db34a09f11353f2afea9
BLAKE2b-256 e37eb8a745362468fcd33e957cd17941224107f3e0c9d3953c650458e662af4b

See more details on using hashes here.

File details

Details for the file pyAgrum-0.13.1.1-cp36-cp36m-win32.whl.

File metadata

File hashes

Hashes for pyAgrum-0.13.1.1-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 f7f1865d6478e3844461f9256e52e31a2325afe8fe0cd2a3d247b7b04f8cbc11
MD5 e9812ef1cbfb306b6769e61f80687354
BLAKE2b-256 75e54dfca96a070bab74b11fde72b1c2df8f0f236ac37437ef0fb1a72f54e0a3

See more details on using hashes here.

File details

Details for the file pyAgrum-0.13.1.1-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum-0.13.1.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 475988d92ff8aa557eff70de11178ee214c4a793d6bd64e074526d35b119c967
MD5 eb3ce37595766600b2a0552d347c2fae
BLAKE2b-256 cfc442186a7b1e039aa1dfef5342b1d27e7a22bbecb22380ccb0d6c3cd9c236d

See more details on using hashes here.

File details

Details for the file pyAgrum-0.13.1.1-cp36-cp36m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for pyAgrum-0.13.1.1-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 cb77f47aabb79edf58dab6aa3d8dadec48abcfc05b3fb033d7c5234022b8cdd8
MD5 ba4001d2da368d1e418f0343474c4793
BLAKE2b-256 c134ae6e43a65a9e25e774d70cb9a9a6567afd73203b3eeb469d4af98d397b83

See more details on using hashes here.

File details

Details for the file pyAgrum-0.13.1.1-cp36-cp36m-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum-0.13.1.1-cp36-cp36m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 28d187b1c07154c0c4b76502231a51acd5b3316f362323d2aa2c00fcdfa6b601
MD5 dd44c9d224c20708c14ac6aad51f4909
BLAKE2b-256 c8b69341ec649f37b32bc91f35b328a1502f11e5a61805247e6b64367372df0e

See more details on using hashes here.

File details

Details for the file pyAgrum-0.13.1.1-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum-0.13.1.1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a5fec94f757cf9a39b11c5b5cda21a5c08b17bfddf6d796ca2b5b8b8557627ff
MD5 20a104d1918d0ad63956b93502fcb9ea
BLAKE2b-256 e382edb4fb0d4c046c0730595165df96b7b75f8bbf6badacdb039081f5ec5775

See more details on using hashes here.

File details

Details for the file pyAgrum-0.13.1.1-cp35-cp35m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for pyAgrum-0.13.1.1-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 34ec039084288300593c68b6843dbc9de0b6bb9d39f3bede4ad3afa3e2519f99
MD5 cbe451c42317fccbb4b70f87dc9ca216
BLAKE2b-256 5f0fd9de7712dfc9a5a2ff4b866ef8976816c15f69b8e96f7916e11c819ee2e2

See more details on using hashes here.

File details

Details for the file pyAgrum-0.13.1.1-cp34-cp34m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum-0.13.1.1-cp34-cp34m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 bf34592beb943337346336b4cd669cbdf32dc7a6f8b5b588692bc2b56923fdee
MD5 0b092965df2b1488a2b68f163e05cba1
BLAKE2b-256 a97ec7dbb913afb7306b3bed84db0e2f3f6b58396faf6215a64ecb87e3b34c57

See more details on using hashes here.

File details

Details for the file pyAgrum-0.13.1.1-cp34-cp34m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for pyAgrum-0.13.1.1-cp34-cp34m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 2f6fe3fc0789e9a6c365087ce9b146d45e72812f9a9951f2627d69992928c921
MD5 c815cd6b0348181aa1702178df97f400
BLAKE2b-256 13a08a117208299f6cf23f20cadaf5c99f7e5b8f33901a273eb99bc61fd98fae

See more details on using hashes here.

File details

Details for the file pyAgrum-0.13.1.1-cp33-cp33m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum-0.13.1.1-cp33-cp33m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 528db38d6e852636a79fa2889571f9d04d1274ca577906d495d82dddf656c964
MD5 3f652be0574e036ab1c00d580c695749
BLAKE2b-256 8d87e682087fcf48eb8c6d3e1140697dcbfd1ca61612afd9a8ba960770618ac3

See more details on using hashes here.

File details

Details for the file pyAgrum-0.13.1.1-cp33-cp33m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for pyAgrum-0.13.1.1-cp33-cp33m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 05679e45bdce4845a2fc17f2a2216c066d6a22ca9154f83c4e4c46885752bbd6
MD5 dee02a7e32bc12568df475bee9c2a898
BLAKE2b-256 a4591dba3aea91f2bea8ae6ca401160e5fa87d52617bdffaff1f554571a89c93

See more details on using hashes here.

File details

Details for the file pyAgrum-0.13.1.1-cp27-cp27mu-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum-0.13.1.1-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 0b47e2c157c411d21ee3b9f9dd8eeb236c2697350b4e49cff0800d87f30da894
MD5 887cd85c07559fbb3919dc313c3de4c5
BLAKE2b-256 5be12c5d39fe3bd0c928fabdfc7f89b7a5ac154f372b809c0be31017e9d3597b

See more details on using hashes here.

File details

Details for the file pyAgrum-0.13.1.1-cp27-cp27mu-manylinux1_i686.whl.

File metadata

File hashes

Hashes for pyAgrum-0.13.1.1-cp27-cp27mu-manylinux1_i686.whl
Algorithm Hash digest
SHA256 8f612da7a702281cb91413cee1f1b021370f45105e75ffb1971b8b085be82b9b
MD5 f05b14602172d97dfcc4dfc04da2a70d
BLAKE2b-256 6dfa1ed44d71bb4227a3259bbe264d052b34c0f4bed1b030d84283e9c385d16b

See more details on using hashes here.

File details

Details for the file pyAgrum-0.13.1.1-cp27-cp27m-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum-0.13.1.1-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 006c6b8ce2b053aaa34aa18c06a42230020eaebe02457912d1eeca79230a4238
MD5 ecc66f6889002f85751a30f8ec38a8cf
BLAKE2b-256 186ad0711cfcb4783d2fed2f32ffb9c25f73cbc26a5c39a4b8262baabe7b0d57

See more details on using hashes here.

File details

Details for the file pyAgrum-0.13.1.1-cp27-cp27m-win32.whl.

File metadata

File hashes

Hashes for pyAgrum-0.13.1.1-cp27-cp27m-win32.whl
Algorithm Hash digest
SHA256 2c02e0ed050dc6c378d6215fffec81c7c8f53a98cd07d45c14fd852897a70819
MD5 f851efdfb4c951926b8ead909d7ca3b6
BLAKE2b-256 a6875c1d3f263557d6bbe174641d9066d18a18b3c8aa498301cfd72d68e14ec7

See more details on using hashes here.

File details

Details for the file pyAgrum-0.13.1.1-cp27-cp27m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum-0.13.1.1-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f3c95287f5eaf77cf86fd7f390ccfebc11e35e8f769ff624093e98f459e70b37
MD5 ba5c3b55b33b2c432c4dc34be467d9b8
BLAKE2b-256 5a20a8939b927fa50b35a564a2b0dc3753e11bc5ebde3d0ded6949832dfcb94c

See more details on using hashes here.

File details

Details for the file pyAgrum-0.13.1.1-cp27-cp27m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for pyAgrum-0.13.1.1-cp27-cp27m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 cc3c35468a1c9fe5ac96257e67d9f8bea0d3bc85d1f8e66c1fa1f3bcc06116da
MD5 5ad6813fe886cc54ab044446aa1b8d94
BLAKE2b-256 52292198756c533244548aaa11d4bf63ce8f57322c28947260a20c17c696fa1f

See more details on using hashes here.

File details

Details for the file pyAgrum-0.13.1.1-cp27-cp27m-macosx_10_13_intel.whl.

File metadata

File hashes

Hashes for pyAgrum-0.13.1.1-cp27-cp27m-macosx_10_13_intel.whl
Algorithm Hash digest
SHA256 5ded7331c27e07ec79e65fcca2fb10405879d0651cb69417b74e1ffb45f75510
MD5 28d28423c8412c6b3db97507eb5df2df
BLAKE2b-256 3a3793626a3660551485c2ac4ca620c94b3f3a7a291dce747bf7cbedd51fed15

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page