Skip to Content

Thanks to Radha D for her contributions in building the model.

In part 1, we discussed the 101 of predictive analytics in SAP HANA using SAP HANA PAL and HANA flowgraph modelling. The drag and drop interface allows us to focus on the analysis without spending too much time writing out complex SQL scripts.

In this blog, we will understand how we can integrate flowgraphs with SAP Design Studio and provide a readily consumable output to the decision makers.

Extending our example from the previous blog, we would like to select different store and product combinations, to be able to view the sales forecast at a granular level. This kind of analysis will help in inventory planning, promotional offers for low selling products and so on. We would also like to choose the number of periods of forecast as well as be able to modify the forecast parameters to ensure a good fit.

Image-1: Visualizing SAP HANA Flowgraph output using SAP Design Studio

Part2-Image1Visualizing SAP HANA Flowgraph output using SAP Design Studio.png

Above is a sample application built using SAP Design Studio to present our case, with text inputs, dropdowns and radio buttons to pass the parameters. This application must be able to interact with the predictive algorithms running on HANA and pass the various parameters to the Prediction model.

Solution -1

A simple approach to do this would be to include a filter node in the flow graph created in part 1 and iterate the steps over all store and product combinations. We can then write the results back to a table and consume it in Design Studio using a Calculation View. This approach can be tedious and also has to be scheduled to run during downtime hours. Also, this would apply the same model parameters to all the store and product combinations which may not yield the best of results.

Image-2: Using filter node to select a particular store and product

Part2Image2Using filter node to select a particular store and product.PNG

Solution2- Doing things on the fly

To visualize something in SAP Design Studio, it should be a column view (from SAP HANA perspective). From our sample application shown above, it is clear that we would need to pass the various parameters as variable values to this column view. The drawbacks of solution1 tells us that this column view cannot be built on just tables as we would like to run the prediction algorithm and the flow graph procedure each time there is a change in the parameters in the front-end. To achieve this, we create a scripted calculation view in HANA and call the flow graph procedure within it. The problem does not end there. Each time there is change to the parameters, the meta-data table, where model parameters are stored, needs to be updated. Then again, write operations are not permitted within scripted views. To work around this, we tweak the flow graph procedure to replace corresponding parameter values at runtime using a simple case statement within the select statement which picks up values from the parameter table.

Image-3: Modified Select statement on the model parameter table

Part2-Image3Modified Select statement on the model parameter table.PNG


Image-4: Actual Select statement on the model parameter table

Part2Image4Actual Select statement on the model parameter table.PNG

Lastly, to change the dimension members (Store and Product) dynamically, we create a custom procedure with two scalar input parameters for Store and Product respectively and replace the  static filter during the pre-process of data in the flowgraph.

Image-5: Modified Dynamic Dimension Filter

Part2-Image5Modified Dynamic Dimension Filter.png


Image-6: Flowgraph – Design Studio integration workflow

Part2-Image6Flowgraph - Design Studio integration workflow.PNG

Finally, this column view is consumable in SAP Design Studio and we can select model parameters as well as dimension parameters on the fly and visualize the predictions accordingly.

This approach can be further extended to other complex predictive algorithms such as classification, regression and decision trees with great visualizations using SAP Design Studio. This can also be extended to other visualization and data discovery tools like SAP Lumira and WebI enabling decision makers with the power of predictive analytics.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply