What do I need in the database for "Customers Who Bought This Item Also Bought"?

Amazon has “Customers Who Bought This Item Also Bought.”

I am interested and want to add this to my shopping cart that I made.

What fields do I need in the database? Any site, blog or resources for this?

Can you suggest a mechanism, how can I encode it?

+6
mysql recommendation-engine
source share
6 answers

Here are some similar questions :

  • How do recommendation systems work?
  • Development of a database engine recommendations
  • How to create your own recommendation mechanism?
  • Methods for creating recommendation mechanisms?
  • Where can I find out about recommendation systems?
+11
source share

You probably do not need new fields in your database - just keep a history of your orders. Then, when you want to find your list of what other people bought:

  • Select all users who have an order containing item X
  • For each of these users, summarize everything they bought.
  • Get the top 3/5 / all and there is your list.
+6
source share

This is not too complicated. Suppose you have the following tables:

  • Customers , CustomerID primary key
  • Products , primary key ProductID
  • Orders , primary key OrderID, foreign key CustomerID
  • OrderItems , primary key OrderItemID, foreign keys OrderID, ProductID

To find the products you are looking for, you need to find the set of customers who have purchased this product identifier:

SELECT CustomerID FROM (Customers INNER JOIN (Orders INNER JOIN OrderItems)) WHERE OrderItem.ProductID = <your product id here> 

Then you need to get other products that these customers bought:

 SELECT ProductID FROM (Customers INNER JOIN (Orders INNER JOIN OrderItems)) WHERE (Customer = <given customer ID>) AND (ProductID <> <your product id>) 

Then select some of the best products and you will go racing.

Note. I am a numerical guy. Guru-gurus will be able to do this in 1 request! :)

+3
source share

You need an order history so you can check for other items that were purchased with the user of the product that is currently being viewed.

+1
source share

You need "Collective Intelligence Programming . " They have some good chapters on recommendations, etc. You will want to read about the differences between Pearson and other measures.

0
source share

See Intelligent Network Algorithms , Chapter 3, Creating Suggestions and Recommendations. To your question: optional, you may need a table with user ratings for different elements. Based on these ratings, you will be able to measure the similarity between two customers, and then perform an assessment based on these values ​​on the items that one of the customers will reach. These ratings are used to rank positions.

Also, see the Apriori chapter 4 algorithm or a general description here ; this works for items bought together and extracting some association rules. Based on these rules, you will find which of the items you sell can be added to the customer’s basket. According to your question: no additional field should be added to your database; you should only maintain a table for group items bought together (basket contents).

0
source share

All Articles