Monday, March 26, 2012

Product Basket Problem

Hi,
I have to build a Poduct basket mining mode

Hi,

I have to build a Product basket mining mode such that when a customer selects

a product the model should be able to recommend him/her some more products.

I have a customer, product transaction table.

I have come across many typical examples where the output is

as follows

CustomerRecommended Products

Cust1a, b, c…….

Cust2e, b,

f……….

But I want the output of the model to be as follows

ProductRecommendedProducts

AB, C, D…….

BE, D, A…….

CD, A, F……

How should my mining model structure and the prediction

query look like?

Your model would look the same - all you would really want to do is to change how you query the model.

Essentially, the question you are asking is "if a customer bought product 'A', what other products might they buy". This is the same as "If customer 1 has product A in their basket, what products should I recommend." Therefore you need a query like this:

SELECT 'A' as [Product], Predict(Products,5) as [Recommended Products]
FROM MyRecommendationModel
NATURAL PREDICTION JOIN
(SELECT (SELECT 'A' as Product) AS Products) AS t

If you wanted to do this for all individual products, you would have to create a shaped input query from your product table. For example

SELECT t.Product, Predict(Products, 5) FROM [My Recommendation Model]
PREDICTION JOIN
SHAPE
{ OPENQUERY(MyDataSource],'SELECT Product FROM Products ORDER BY Product') }
APPEND
( {OPENQUERY([MyDataSource],'SELECT Product FROM Products ORDER BY Product'}
RELATE [Product] TO [Product])
AS [Products]
AS [t]
ON [My Recommendation Model].Products.Product=t.Products.Product

No comments:

Post a Comment