Recommendation System in Machine Learning

Have you ever wondered how YouTube suggests videos or the Amazon shopping app recommends products? This is done using a recommendation system for each use case. Nowadays, recommendation systems have become a significant part of our lives as well as the sales funnel of businesses. In this article, we will discuss the working of a recommendation system, the technologies used to build recommendation systems, and some industry use cases of recommendation systems.

How Does a Recommendation System Work?

All of us have a certain pattern in our behavior. Whether we watch videos or read the news, we prefer some content categories while we ignore others. Based on our preferences and behavior, the recommendation system decides the content that is suggested to us. For instance, look at the following image.

Here, the website is showing only electronics items in my suggestions. This is due to the reason that I mostly buy and view electronics items on the Amazon app.

Let us discuss another scenario. When we click on a product on the Amazon shopping app, it also shows the related items to the products. For instance, if we look at a monitor for our PC, it shows the related items to the specific product as shown in the following image.

So, how does this happen?

Any recommender system works in three steps i.e. Candidate generation, Scoring, and Re-ranking.

Candidate Generation

When the recommendation system has to suggest some items to us, it takes an identifier like device id or user id so that it can suggest items based on our preferences and browsing history. If the recommendation system has to suggest items related to a specific product, it takes the product id as its input. After taking the input, the recommendation system searches for a subset of candidate items that have to be recommended to us.

In this step, the candidates are extracted from a large corpus of data. Hence, we use advanced indexing techniques and machine learning methods to search for the candidate items from the corpus. Most recommendation systems use collaborative filtering or content-based filtering techniques for candidate generation. We will look into this in the next sections.


After extracting the candidate items from the corpus, we assign a score to each candidate item based on user preferences. 


Once the scores are assigned to the candidate items, we remove the items with low scores, and items with higher scores are recommended to the user. This is done to make sure that the user gets personalized recommendations and buys a recommended item or watches a recommended video, etc. 

Machine Learning Techniques Used in Recommendation Systems

As said earlier, we use either content-based filtering or collaborative filtering for candidate generation in a recommendation system. Let us discuss them one by one.

Content-Based Filtering

In content-based filtering, use the features of an item to recommend items to a user. Here, the item might be a product on an e-commerce platform, a video on a streaming platform, an article on a news website, or a post on a social network. It depends on the platform for which the recommendation system is created. 

In content-based filtering, we use the features of an item for selecting other candidate items. For instance, on a shopping platform, we will use the category, sub-category, brand, price range, etc to look for candidate items. Similarly, on a video streaming platform, we will use the video length, genre, rating, language, etc to create candidate items. 

If a user buys a product P1 or watches a video V1 that is similar to another product P2 or video V2 respectively, content-based filtering recommends P2 and V2 to the user. For instance, if you add a phone to your shopping cart, the system will recommend phones in a similar price range, ratings, and brands. Similarly, if you watch documentaries on your YouTube, the system will recommend more documentaries to you.

In essence, content based-filtering solely depends on the similarity between the items for candidate generation.

Advantages of Content-Based Filtering

  • Content-based filtering doesn’t take into account user behavior. It solely depends on the similarity between items. Due to this, it is quite easy to implement this algorithm for candidate generation. 
  • If a person likes certain types of content or buys only the products in a certain category, the recommendation system that used content-based filtering will suggest more items in the same niche. So, it can increase user interaction to a great extent for the users who are very specific about what they read, what they watch, or what they buy.

Disadvantages of Content-Based Filtering

  • Content-based filtering only suggests related items. For instance, a video recommendation system using content-based filtering will keep suggesting videos of a single type to the user. Although it increases user interaction, it will not work after a certain amount of time. The user might get bored looking at similar content. Similarly, if a user buys a certain item, he won’t be willing to buy a similar product after that. In this case, product recommendations using content-based filtering will not get us good results.
  • In content-based filtering, the features of items are manually selected. Due to this, the machine learning engineer needs to have a good understanding of the domain for which the recommendation system is being made. However, this is not possible at times. Due to this, a recommendation system using content-based filtering will only be as good as the domain knowledge of the ML engineer. 

Collaborative Filtering

Collaborative filtering uses user behavior along with the features of an item for candidate generation in a recommendation.  It uses the similarity between users to recommend items. For instance, consider the following situation.  

If user X buys four products  A, B, C, and D. Another user Y buys four products A, B, C, and E. Now, a recommendation system using collaborative filtering will observe that the buying behavior of users X and Y are somewhat similar. Hence, it will recommend product E to X. Similarly, it might recommend product D to user Y. 

Advantages of Collaborative Filtering

  • In collaborative filtering, we don’t need to hand-engineer the features of the items. The embeddings for the items in the recommendation system are automatically generated. Thus, a machine learning engineer doesn’t require domain expertise for the industry in which the recommendation system will be used. 
  • Content-based filtering doesn’t suggest items from new categories to the users. However, collaborative filtering-based recommendation systems might recommend items from different categories to the user. This is because of the reason that collaborative filtering uses similarities between users for candidate generation. If user A has a certain degree of similarity with user B and A watches videos or buys items that B is not interested in, the recommendation system will suggest the video viewed by user A to user B even if he or she is not interested in that. Due to this, user B can explore more options and user engagement will increase. 
  • Collaborative filtering-based recommendation systems automatically capture the inherent characteristics of users. 

Disadvantages of Collaborative Filtering

  • If the recommendation system is not trained using an item’s data, it will not suggest the item to any user. Similarly, if the recommendation system isn’t trained with a user’s data, it won’t be able to generate recommendations for the particular user as it doesn’t have any embedding for the particular user. This is called the cold-start problem. We often use heuristics to solve this problem.
  • If we have sparse data,  the recommendation system cannot generate useful recommendations. We need a significant amount of historical data to make recommendations that are relevant to the user.
  • With the increase in users and items, the dataset also grows. The recommendation system might not be able to handle a large amount of data and scaling might be an issue in such a case. 

New Algorithms for Recommendation Systems

Nowadays, companies are using hybrid recommendation systems that use a mixture of content-based and collaborative filtering. This overcomes some of the drawbacks of content-based filtering as well as collaborative filtering-based recommendation systems. The movie streaming platform Netflix also uses a hybrid approach for recommending new movies to users. 

Instead of filtering techniques, deep neural networks can be used for recommendation. Deep neural networks can easily remove drawbacks like the cold-start problem.

Applications of Recommendation Systems

Following are some of the applications of recommendation systems.

  • YouTube video suggestions: Most of the watch time on YouTube comes from recommended videos. The videos are recommended using a recommendation system.
  • Product Suggestions: As we saw in the images in the previous sections, e-commerce websites use user’s data to recommend products. This helps the websites increase their sales volume.
  • News Feed: The news feed provided by Google is personalized for each person based on their preferences and browsing behavior. Selection of the news feeds is done using advanced recommendation systems. 
  • Movie Streaming Platforms: Movie streaming platforms always suggest videos that you may watch. This helps them increase the watch time and hence revenue.
  • App Suggestions on Google Play Store: Most of the app downloads on the Google Play store is due to the apps recommended to the users.


In this article, we have discussed the basics of recommendation systems and how they work. We have also discussed collaborative filtering and content-based filtering in with their advantages and disadvantages. I hope you enjoyed reading this article.

To learn more about machine learning, you can read this article on regression in machine learning. You might also like this article on k-means clustering using sklearn in Python. 

Stay tuned for more informative articles. 

Happy Learning

Similar Posts