cancel
Showing results for 
Search instead for 
Did you mean: 

How to restrict product recommendations to a given set of products?

Former Member
0 Kudos

Hi all

I've recently started using the SAP Predictive Analytics Product Recommendation Model. It's really easy to use and looks like an easy win in terms of improving sales.

I'd like to know what's the best way to go about restricting the recommendations to a given list. I'll provide the context and reasoning in the example below

Say we have a database of Customer ID's and Products purchased. We then want to create product recommendations but only for products that we currently have stock of. The following is the steps one could take to do this:

1. Create the model based on all product/customer combinations i.e. whether we have stock for the product or not

2. Run the model on all customers

3. Export the results

4. Filter out the recommended products for which we don't have stock

The reason I didn't filter my results to start off with (ie create the model only for products where stock is available) is that I want the rules to be created irrespective of whether there's stock now, so that when the rule is applied and it sees that Customer X purchased Product Y (which currenly there is no stock of, but the purchase was made last month), then it recommends product Z (which we do have stock of). Hence, the rules need to be created on all products and not just those for which we have stock of.

Is there a better way to do this? Due to the number of recommendations per customer the data gets large rather quickly, so if there's a better way to do this, I'd love to know

Many thanks
Ria

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi All

Let me update this question and finally mark it as answered

It seems that the best way to limit recommendations to certain criteria (e.g. items with stock > 0) is a combination of SAP PA and another programming language (e.g. SQL). The following are the steps involved

1. Run the model using SAP PA Product Recommendation Engine - run it on all transactions

2. After generating the model, save the model as a database

3. The database that you have saved has ALL the recommendations per item

4. Using this database, and others e.g. transactional db which has previously purchased items, or a stock table which has stock levels - one can create a query which can give you exactly what you want e.g. top 5 items where stock is greater than X

I'm busy putting together a short doc on exactly what to do as I'm sure many of you will find it useful.

Regards

Ria

Answers (4)

Answers (4)

achab
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Ria,

Have all our questions been answered or not yet?

Thanks & regards

Antoine

abdel_dadouche
Active Contributor
0 Kudos

Hi Ria,

Have you had a chance to look into the suggested response?

Thanks for sharing your feedback

@bdel

Former Member
0 Kudos

Hi Abdel

Thanks for your suggestion. I haven't yet had the chance to test it out but I definitely will test it out soon and revert with feedback

Many thanks

Ria

Former Member
0 Kudos

Hi

Do you know of tutorials or other examples showing the product recommendation methodology in the Social model?

Regards

Ria

marc_daniau
Advisor
Advisor
0 Kudos
Former Member
0 Kudos

Hi Marc

Thanks. I should have stated that I have gone through the User Manual and still I'm not sure how to derive the graph. The user manual was not helpful - it states the following:

"This option is only available when a bipartite graph has already been created in the current model, either from a data set or loaded from an existing model."

However my issue is that selecting the "Derive Graph from a Bipartite Graph:" option is only available at the start of the process. How does one get back to this step after creating the bipartite graph?

Any ideas? Have you perhaps created such a model?

Cheers

Ria

marc_daniau
Advisor
Advisor
0 Kudos

Hi Ria,

Here is an example of Deriving a graph from a bi-partite graph.

You first start with a graph of type Transactions (user guide Chapter 4.6.2)

You can use the data set customers_transactions.txt that is delivered with the product under the folder .../Samples/KAR

You create a Transaction graph. Then Click on Add Graph.

Choose menu Derive Graph.

Specify the entity (here user)

A new graph is added

Marc

Former Member
0 Kudos

Hi Marc

Thank you! It wasn't clear to me that one should add the second graph on the graph definitions section.

Regards

Ria

achab
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Ria,

I would recommend that you "close" one of the two SCN discussions to ease the follow-up moving forward.

Probably we can keep this one open if need be and close .

Thanks for your help,

Best regards

Antoine

abdel_dadouche
Active Contributor
0 Kudos

Hi Ria,

My response will be related to Automated Analytics.

I will assume you have created a "Recommender" model.

The "Recommender" flow was build as simple as possible, and therefore misses some filtering features available in "Social".

Keeping in mind that a "Recommender" model exposes a subset of the "Social" model, we can easily build the same model and use the filtering option.

In your case you can use the "Target Event" field to identify product available in stocks from your transaction dataset. Then when deriving the transaction graph, you can enable the "Target Event Required" option to filter the derived and keep rules where at least one of the item has a "true" target.

During the model creation phase, an additional filtering step will be applied.

I was able to test this in SAP Predictive Analytics 2.0, Automated Analytics.

Regards

@bdel

Former Member
0 Kudos

Hi Abdel

I've been trying to follow your suggestion struggling to to do so. The issue I'm having is where to define the "Target Event" field.

The following are the steps I'm taking in the creation of my model:

1.Open SAP PA Automated Analytics

2. Select "Create a Social Network Analysis"

3. Select "Build a Social Graph From a Data Set"

4. Load and link my data set

5. Create first graph

5.1. Graph type = Transactions

5.2. Source Node = CustomerKey

5.3. Target Node= Product

6. Create second graph

6.1. Add graph

6.2. Derive from a bipartite graph

6.3. Entity = Product (at the end I want to recommend products for customers based on the product rules established and the products they already have)

6.4. Min Support = 2

6.5. Weight = Jaccard Index (recommended from help section)

6.6. Max iterations = 1

6.7. Filters: Unselect Min Pred Power (default setting for Product Recommendation engine)

7. Graphs are now setup, go through rest of steps without changing anything and generate model

At which point in the above steps should I have set the Target Event field?

FYI - the Help section on the Target Event doesn't really help. Furthermore, the only referecen to a Target Event in the User Manual states that "In the Candidate List tab, you can define the population of your graphs by checking the Target Event Required option. " However I can't find anything more on this topic

I've attached the test data set that I'm trying to build this model on.

Many thanks

Ria

abdel_dadouche
Active Contributor
0 Kudos

Hi,

I think there is a regression in the product, the target event field has been removed since PA 2.0 for a reason that I cannot explain.

I found the related defect in Jira and this should be fixed in 2.4.

The feature still exist but via KxShell scripting which what I tested initially.

Regards

@bdel

david_serre
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi everyone,

This feature will be back in PA 2.4.

Regards

Former Member
0 Kudos

Thanks. Please update the User Guide and Help sections of PA accordingly as well

achab
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Ria,

SAP Predictive Analytics 2.4 has been released today.

Could you please install the new release and let us know if everything works as expected for you?

Best regards,

Antoine

Former Member
0 Kudos

Hi Abdel

I followed your suggestion and did the the following:

In my input data I created a column called "Use" which has values of "Yes" and "No"

I then opened the Social Model and created the first social graph as "Transactions" graph type with the Target set to the field called "Use" and the Target Key set to Yes

I then create the second graph derived from the above bipartite graph and generate the model

It worked great and restricted my results to only products that had a "Use" = Yes in the input data

HOWEVER,

I tried running a new model with EXACT same approach outlined above Except that I changed the Target Key from Yes to No

In this instance when I generate the model then the results are not filtered to products that had a "Use" = No in the input data. Any idea what's going on here? Why does it work for Yes and not No?

Thanks
Ria

Former Member
0 Kudos

My answer is in response to the Expert Analytics Apriori algorithm, I can't speak to the Automated Analytics algorithm.

I don't really think there is a good solution besides what you have proposed because you are probably going to be having stock changes more frequently than you would run product suggestion rules. 

How are you inputting your data (Tabular vs Transaction format)?  If in transaction format (where you give the algorithm the basket ID and the product name, then definitely not (if you want to include out of stock products in the antecedent). 

If you are putting it in tabular format, I believe this preserves purchase order, allowing users to put in columns for "product 1", "product 2", etc... in some sort of theoretical order (purchase timing, etc...)  If you were inputting data in tabular format, you could simply eliminate any baskets that included OOS products for Product 2+ entries, though that would also eliminate any suggestions for Product 1 + Product 2 => Product 3.  Also, unless you are running rules on demand for every suggestion, your OOS list might change, so I doubt this would be a very practical suggestion.

 

If you just want fewer suggestions per customer, you can tweak the confidence thresholds, but I think that eliminating suggestions for OOS products is useful outside of just narrowing down suggestions.