Salome HOME
bos #26458 Versioning of sources via git commit id (sha1)
[modules/yacs.git] / doc / pmml.rst
1 .. _pmml:
2
3 *******************************************************
4 Loading and executing a PMML file
5 *******************************************************
6
7 The Predictive Model Markup Language (PMML) is an XML-based file format developed by the Data Mining Group 
8 to provide a way for applications to describe and exchange models produced by data mining and machine learning 
9 algorithms.
10
11 Yacs provides an elementary python node called **PyLoadPMML** that generates an object of type **pyobj** 
12 from a model read in a PMML file.
13 This pyobj is a **PyFunction** that can be executed in a python node created by the user.
14
15
16 .. _pmmlModelTypes:
17
18 Authorized PMML model types
19 ===================================
20
21 Node PyLoadPMML uses the swig/python interface to library libpmmlLib.so (Linux) or pmmllib.dll (Windows). 
22 This library handles :
23    - **Neuronal Network** models and
24    - **Linear Regression** models.
25
26 .. _pmmlPyLoadPMML:
27
28 Description of PyLoadPMML
29 ===================================
30
31
32    - **Input ports** 
33
34 ================= ================= ========================================
35 Input port name     YACS type         Comment
36 ================= ================= ========================================
37 filename            string            Name of the PMML file, 
38                                       including its path if the file is 
39                                       not in the current directory
40
41 modelname           string            Name of the model to load
42
43 pmmltype            string            Type of the model. Value is one of 
44                                       kLR (linear regression) 
45                                       or kANN (neural network)
46 ================= ================= ========================================
47
48
49
50    - **Output ports** 
51
52 ================= ================= ========================================
53 Output port name    YACS type         Comment
54 ================= ================= ========================================
55 pyFunc              pyobj             PyFunction representing the model 
56                                       This function takes a vector of
57                                       doubles as input parameter and
58                                       returns a value of type double
59 ================= ================= ========================================
60
61
62 .. _pmmlModelExecution:
63
64 Example of model execution
65 ===================================
66
67 Create a YACS schema that uses node PyLoadPMML and add a python node that will execute the 
68 the pyfunction created by PyLoadPMML. The YACS schema with the execution python node code 
69 is shown below : 
70
71 .. image:: images/pmml_exec.png
72   :align: center
73
74 The characteristics of the execution node are the following:
75
76    - **Input ports** 
77
78 ================= ================= ========================================
79 Input port name     YACS type         Comment
80 ================= ================= ========================================
81 myFunc              pyobj             Linked to the PyFunction generated 
82                                       by PyLoadPMML 
83
84 params              dblevec           Vector of doubles,
85                                       input of the PyFunction
86 ================= ================= ========================================
87
88    - **Output ports** 
89
90 ================= ================= ========================================
91 Output port name    YACS type         Comment
92 ================= ================= ========================================
93 o5                  double            Result of the model execution 
94 ================= ================= ========================================