Skip to Content
Author's profile photo Marc DANIAU

Product Recommendation against an SAP HANA view with SAP Predictive Analytics 2.3 – Part 1

All of us, at one time or another, have rented or bought an item based on a suggestion made by a friend. This friend, who influenced your purchase decision, shared your taste, your interests, or thought he knew you enough. Most likely he himself saw that movie, read that book or used that device he talked to you about. Nowadays, when renting or shopping on-line, we get suggestions from recommender systems. These collaborative filtering systems have access to much more data than our friends do. Their algorithms, the ones that are able to tell us “people who bought/rented item X also bought/rented item Y”, can access information on the entire population of users (not just our friends) and look at the complete catalog of items (not just the few items known by our friends).

A data set suitable for use by a recommendation engine must be made up of a minimum of two fields: user and item. Usually the data set also includes a timestamp and a rating or quantity. The data set for this example uses an SAP HANA view on sales invoices.


This analytic view includes three variables. One variable requests that the user choose a country (mandatory). The two other variables let us filter invoices on flags that tell when the purchase occurred, either during the weekend or at night.

Let’s use this sales invoice view to create a recommender with SAP Predictive Analytics version 2.3.


First, we connect to the database through the SAP HANA ODBC driver and choose a view. The view can come from an SAP BW system or any custom application built on SAP HANA.


We ask the application to “Analyze” that view and, since it includes variables, a window pops up with prompts.


After choosing a country, we specify the roles required for a recommendation.


We go ahead and generate the model that will be specific to the country we have chosen.


We can now display the recommended products for a given French customer.


At this stage we have created a recommendation model based on purchases made in French stores. We will see in part 2 how we can automatically generate one recommendation model per country.


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Antoine CHABERT
      Antoine CHABERT

      Great blog Marc!

      Author's profile photo Former Member
      Former Member

      Great indeed. This is new for SAP HANA in 2.3 but for all of you using non-SAP HANA data sources, you can see a step-by-step Product Recommendation here :Automated Analytics - Generate recommendations: SAP Predictive Analytics 2.0 - YouTube