2 \page pyexamples PMMLlib Python examples
4 \section sectionC Update a model in an existing PMML file :
5 The updating is done in two steps:
6 - 1 : delete the XML node of the model with method UnlinkNode();
7 - 2 : re-create the model.
9 PMMLlib p ( fileName, log );
12 p.SetCurrentModel( modelName, modelType );
14 # Delete the XML node of the model
16 # Recreate the model with new parameters
17 p.AddRegressionModel(« monModele », PMMLlib::kREGRESSION, « regression » );
27 \section sectionD Backup and update a model in an existing PMML file :
28 It is done in two steps:
29 - 1 : backup the model in an XML node with name modelName_<i> with method BackupNode();
30 - 2 : re-create the model.
32 PMMLlib p ( fileName, log );
35 p.SetCurrentModel( « monModele », modelType );
37 # Save the model in a new XML node
40 p.AddRegressionModel(« monModele », PMMLlib::kREGRESSION, « regression » );
49 \section sectionE Add a model in an existing PMML file :
52 PMMLlib p ( fileName, log );
55 p.AddRegressionModel(« monModele », PMMLlib::kREGRESSION, « regression » );
62 \section sectionF Read a model and execute it :
65 P = PMMLlib( fileName, log );
66 p.SetCurrentModel( modelName, modelType );
68 pyStrCode = p.ExportPythonStr( « myPyFunc », « function header » );
71 # Eval myPyFunc which is now known as a python function
72 inputs = [1.,2.,3.,4.]
73 res = myPyFunc(inputs)