Basket Analysis with SAP Predictive Analysis and SAP HANA – Part 2: Visualisation of Results
Following on from Part1, I now want to show you how we can easily do some further analysis of the Market Basket Analysis (MBA) Output by using SAP HANA Studio, SAP Predictive Analysis (PA) and/or SAP Lumira.
The output of the Basket Analysis, Association Analysis (HANA Apriori algorithm) is very straightforward:
It shows the product purchased (PreRule), the secondary product(s) (PostRule), and then some calculated fields – Lift, Support and Confidence. Wikipedia can give you the details how each of these is calculated. When performing MBA, we can choose if we are looking for a match between 2 products or more than 2 by using Aprori or Apriori Lite respectively.
I have found that the lift is the most useful of these columns as it combines the support and confidence to give you an idea of how good the rule is. For example does it occur frequently and if one product is found how likely is it that the other product will be in the same basket.
First in SAP HANA studio we can easily see this output and build a simple Analytic View (AV) for us to consume in PA/Lumira.
The Analytical View allows us to derive a new field and then specify some metadata such as the measure columns.
Here’s the output table definition we created in Part1
And here’s the data that holds
We can build a simple Analytical View with just this table
I have found it useful to combine the PreRule and PostRule into a single field, so we will do this with a calculated column as below.
Now we do need to define the Aggregation for the measures, and there is not really any of them that are appropriate, but as we will also include the Rule or the PreRule and PostRule it will work fine with SUM.
We can now use Lumira / Predictive Analysis to create some further visualisations using this Analytical View.
See Below for a selection that I have created in just a few clicks.
I have written a further blog The SAP HANA Effect, looking at how this changes the business process and analysis of basket data This can be found in the SAP HANA and In-Memory forum. I have now detailed some further techniques that can be applied to Basket Analysis to get even more insight – Enhancing Market Basket Analysis with PA 2.0 and SAP HANA.