Exporting & Consuming PA created PAL predictive model in HANA
With SAP PA 1.0.11, it is possible to export created predictive model as HANA Stored procedure. This makes the created predictive models consumable from applications on HANA without having to go to PA to “score” the model. This article explains how you can do that.
1. Acquire the data using PA & train a predictive model using an algorithm. I am using below HANA C4.5 on the results of HANA K-Means.
2. Now, right click on the HANA C 4.5 (or any component in your analysis which generates the model and chose “Save the Model” option.
3. Now, go to “Saved Models” tab and right click on model that was saved in Step 2 and select “SAP HANA Stored Procedure” option.
4. Provide the schema in which the model needs to be stored and also name of the procedure & click on Finish to export the model.
P.S: Don’t have spaces or special characters in the name of the procedure
6. Now login to HANA Studio and see the model in the Catalog->Procedures section in the Modeler perspective.
8. See the SQL statements that made the procedure and closely observe the sections which are commented. PA provides the statements to manage lifecycle management of the procedure. If you take the commented portion of the statements and run it in the Studio, you would be able to drop all the objects related to the procedure.
9. Now, let us see how you can invoke this procedure from an application (in this case Studio) to score the model on a new set of data.
10. Open a SQL console and create a new table to hold the results.
11. Now, call the procedure to score the model on the table “NewStores” which contains unseen data.
12. View the newly created table contents in the studio using the preview option.
13. This way, you can score the PA created PAL model from any application.
For the detailed list of new features in PA 1.0.11, refer to the blog here: http://scn.sap.com/community/predictive-analysis/blog/2013/06/07/sap-predictive-analysis-10-sp11-new-features-at-a-glance