Data Science

Do you know how e-commerce websites recommend you things?

19th Jan `15, 12:08 PM in Data Science

Do you know how e-commerce website are able to predict and recommend products that a consumer is more…

Raghav Radhakrishnan

Do you know how e-commerce website are able to predict and recommend products that a consumer is more likely to buy? Well, the trick lies in their recommendation engines!

A recommendation engine is a system which helps people choose what they want, in an easy and efficient way by displaying recommendations based on past data. Though most of us don’t know what a recommendation engine is we are using them regularly in one form or the other. To give an example when I search for books in Amazon and look for Paulo Coelho and buy his “The Alchemist”, next time I log on it shows me other books of Paulo Coelho, this is an example of working on past data. Now when I buy a phone from Amazon it shows a tab called “frequently bought together” and other recommendations like “people who bought this also bought these”, this is based on data from other customer’s buying trend.

Last time I bought a set of speakers I rated the product likewise most of us would have rated or commented on an item after we purchase it, this is called explicit data collection. Similarly ranking items, wish lists, are all modes of explicit data collection.

The other more geeky way is, observing the browsing pattern; time spent on each item on the website, combination of products bought together, analysing previous search history, etc are all methods of implicit data collection.

Obviously the companies want to increase their sales and maximize their profits. They use this data to analyse their existing and potential customers’ e-habits or their digital footprint to serve them better by recommending things which are most suitable for them. To go more in detail, there are three types of approaches for recommendation engines: Collabrative filtering, Content based and Hybrid

Collabrative filtering

Collabrative filtering is the recommendation engine based on historic behaviour or prior use. This can be based on the same person or based on other people with similar choices/ tastes. In simple terms this method finds common ground between people to recommend to others what they have missed on. Let’s take the same example of books we took earlier.

User The Alchemist The Immortals of Meluha Inferno The Secret
A 4.5 - 3 4
B - 4 - 3
C 4 - 3.5 -
D 3.5 5 4

From the above table it can be understood that user A rated “The Alchemist”, 4.5 and Inferno, 3 and “The Secret”,4. Lets look at a similar user now say user C who rated “The Alchemist” at 4 and “Inferno” at 3.5 but he has not rated the “The secret” so we can suggest him that based on user A’s rating.

Similarly let us look at users B and D. User D has rated “the Alchemist” at 3.5 and “The Immortals of Meluha” at 5 and “The Secret” at 4. Whereas B has not rated “The Alchemist” but has rated the other books very similar to D so we can suggest him that.

Using data analytical tools similarities are drawn between two samples to recommend. The engine would be able to predict more accurately as the volume of data increases. LinkedIn, Reddit, YouTube, Netflix, are some of the many companies which use collaborative filtering engines.

Content Based

Content based recommendation engine recommends based on the users’ preferences in the past. For example a user reads a review about a book / searches about the book on the internet or rates the book; the content based filtering can recommend the book or similar books. This uses information only from that user and the recommendations are not based on other user’s behaviour.

IMDB (Internet Movie Database), Rotten Tomatoes are some of the many () which use Content based engines.


A hybrid system combines both collaborative and content based together to increase efficiency of the recommender system.

Now, do you want to build a simple but powerful recommendation system? Download Practical Machine Learning: Innovations in Recommendations to learn more.