METADATA.in 3.59 KB
Newer Older
Lionel's avatar
Lionel committed
1 2 3 4
Metadata-Version: 2.0
Name: pyagrum
Version: @[email protected]
Summary: pyAgrum is a Python wrapper for the C++ aGrUM library
5
Home-page: https://agrum.gitlab.io/
Lionel's avatar
Lionel committed
6
Author: Pierre-Henri Wuillemin and Christophe Gonzales
7
Author-email: [email protected]
8
License: LGPL
Lionel's avatar
Lionel committed
9 10 11 12 13 14 15 16 17 18
Keywords: probabilities probabilistic-graphical-models inference diagnosis
Platform: any
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: C++
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
19
Classifier: Programming Language :: Python :: 3.4
Lionel's avatar
Lionel committed
20 21
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
22
Classifier: Programming Language :: Python :: 3.7
Lionel's avatar
Lionel committed
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: Science/Research
Requires-Dist: numpy (>=1.8.1)

pyAgrum
=======

``pyAgrum`` is a Python wrapper for the Agrum library, to make flexible and
scalable probabilistic graphical models for inference and diagnosis.

Sample code:

.. code:: python

    import pyAgrum as gum

    bn=gum.BayesNet('WaterSprinkler')
    print(bn)

Example
=======

.. code:: python

    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
=======

103
Copyright (C) 2005,2019 by Pierre-Henri WUILLEMIN et Christophe GONZALES
Lionel's avatar
Lionel committed
104 105
{prenom.nom}_at_lip6.fr                                               

106
The aGrUM/pyAgrum library and all its derivatives are distributed under the LGPL3 license, see https://www.gnu.org/licenses/lgpl-3.0.en.html.
Lionel's avatar
Lionel committed
107 108 109 110 111 112 113 114 115 116 117

Authors
=======

-  Pierre-Henri Wuillemin
-  Christophe Gonzales

Maintainers
===========

- Lionel Torti
118
- Gaspard Ducamp
Lionel's avatar
Lionel committed
119 120