Enhancing SAP Predictive Analysis with bespoke prediction algorithms using ‘R’

9 October 2014

Peter Douglas

Peter Douglas

Senior Consultant

Have you ever wondered if there is more that can be done with the information your business collects? You could be sitting on a gold mine of useful data that could be turned into powerful insights, helping to predict the outcome of decisions that have far reaching commercial implications.

I recently dusted off my data science skills and looked at the extent to which the statistical analysis software 'R' could be integrated with SAP Predictive Analysis (PA), an advanced analytical tool offered by SAP.

Following SAP’s acquisition of KXEN last year and the introduction of ‘InfiniteInsight’, SAP published a roadmap expressing the intention to combine ‘InfiniteInsight’ with SAP PA. This showed a commitment to continuing to offer the flexibility of SAP PA whilst integrating it with the additional sophistication of ‘InfiniteInsight’.

'R' is a versatile statistical tool used extensively by the global scientific community and is finding more and more users in the commercial world too. SAP PA allows ‘R’ scripts to be integrated as prediction algorithms (to complement pre-built SAP off-the-shelf algorithms) whilst offering functionality that makes it user-friendly for business users. An example is the ease of selection of data sources and easy creation of graphical outputs.

Once created, ‘R’ algorithms can be considered black boxes by business users and can be applied to data using a straightforward graphical interface. What makes this setup particularly powerful is that a wide range of analysis libraries are quickly available to be used – many of which are used extensively for data analysis in science and industry. Some applications could include the use of association algorithms for “market basket analysis” of product sales or cluster analysis for use in determining customer marketing target groups.

A recent scenario I worked on

Recently for the purposes of a demo I chose to apply SAP PA to a use case in the Consumer Business industry.  An annual challenge exists for Commercial Planners and Account Managers in consumer businesses to determine exactly how effective their plan will be for the next year's trade investments. For example they may have provisionally planned a set of promotional activities with associated product pricing discounts and have the challenge to prove that the plan will yield acceptable results in terms of sales volumes and revenue. They could use their experience and knowledge of the market to make their case, but how can they be sure this will be accurate? A more analytical approach could exploit the power of market point of sale (POS) data to derive models that accurately predict the outcome of the plan for the next year, as long as a good quality dataset is available to learn from. This would take the guesswork out of planning, instead offering a systematic and scientific approach.

The demo

In the demo I used some test POS data to derive a model that was then used to predict the outcome of a trade investment plan for the year. I wrote an ‘R’ algorithm in SAP PA that both derived the model and applied it to the plan. This used analysis libraries freely available and widely used in the world of science, which applied non-linear regression techniques to analyse pricing and sales volume data.

For the purposes of determining the effectiveness of the prediction, planned pricing data was used where the results were already known. As an output the algorithm created an initial plot for the user to get instant insight into the predicted sales; this could be used for 'what if' analysis, where the user tweaks the input and looks at the effect on the results. It also produced a results table for graphing in SAP PA – a comparison of these graphical outputs is shown below.

‘R’ algorithm output

PA bar plot of results

For some weeks shown in the results above, the predicted sales volume closely follows the actual observed volume, but there are some weeks where the prediction diverges from reality. A great advantage of using ‘R’ in SAP PA is that an algorithm can be refined to improve the accuracy of the model if tests show areas for improvement such as in our POC results (e.g. we didn’t include ‘seasonality’ in this simple POC).

Another clear strength of SAP PA is that business-ready graphical reports can be created easily from the output data. Tools such as SAP Demand Signal Management (DSiM) can be used for data cleansing of the input data. This is extremely important, since messy input data can lead to inaccurate and misleading results (see earlier comments on accuracy).  Finally, SAP PA accommodates several different types of data sources, not least SAP HANA and its future-proofed handling of big data: a necessity in good predictive analysis.

The above is just one example of the capability of SAP Predictive Analysis when coupled with ‘R’. This truly is a versatile tool, which opens up a world of possibility in advance analytics. More and more businesses are taking a data science approach to tackle business problems; with this tool, so can you!

 

About the author

Peter Douglas

Senior Consultant

Focused on helping businesses gain valuable insight from their enterprise data through the delivery of solutions in predictive & advanced analytics.

Since arriving at Bluefin, Peter has had the pleasure of being part of challenging and rewarding projects across the Consumer Business, Manufacturing and Pharmaceuticals industries, for some well-known global names. His primary focus is working with clients to understand and exploit the power of emerging capabilities in advanced analytics and apply this to their business needs. His skills and hands-on experience span a range of SAP technologies, such as HANA / BW, Predictive TPM and CRM.

Peter’s passion for all things “Data Science” manifests itself in championing the predictive & advanced analytics ecosystem of SAP tools as a great opportunity for clients to tap into the power of their data to answer targeted business questions with accuracy and insight.

His previous life as a Quantum Physicist and PhD Grad has left Peter with old habits: in everything he does he loves testing theories and experimenting with new ideas and technology. He’s also addicted to continually learning new things.

Outside of work Peter enjoys life in London and, when he can, explores the World.

Bluefin and SAP S/4HANA - welcome to the one horse race