Society of AI

Sep 23, 2020

9 min read

Recommendation System

Introduction To Recommendation System

● Recommended system is an unsupervised algorithm of machine learning which is more important from a business perspective,advertisement, etc. Recommendation Systems use the trend of people’s actions to predict what they may want or like. Basically the main goal of recommendation systems is to give “relevant” suggestions to users.

● However, peoples’ tastes may vary, but they generally follow patterns. By that, I mean that there are similarities in the things that people tend to like or another way to look at it, is that people tend to like things in the same category or things that share the same characteristics.for example if one person has purchased bread then that is high chance that that person also going to purchase butter.

● A Recommended System is very much important in modern society because today we have a number of options to choose particular thing due to the prevalence of the Internet.

● The Recommender system has many applications. Recommender systems are usually at play on many websites. For example, suggesting books on Amazon and movies on Netflix. Today, everything on popular website of Netflix is driven by customer selection. If a certain movie gets viewed frequently enough, then Netflix’s recommender system ensures that that movie gets an increasing number of recommendations.

● Another example can be found on e-commerce websites like amazon, flipkart etc. Here we have got recommendation based things that we have searched previously.

● On social media, sites like Facebook, LinkedIn, regularly recommend friendships.

● Recommender systems are even used to personalize your experience on the web. For example, when we go to a news platform website, a recommender system will make note of the types of stories that we clicked on and make recommendations on which types of stories you might be interested in reading in future.

● If we read some articles on medium or quora then it recommended us the new articles those are related with the articles that we read previously.

Popularity base recommended system:

○ It is the most easiest recommended system to build.

○ As the name suggests, a popularity based recommendation system works with current trends.

○ It basically uses the items which are popular according to the current trend.

○ For example, in any shop if some items are usually brought by every new users then the shopkeeper may suggest that item to the user who just came.

○ But personalization is not available in this method.Because generally,every user has their own choices.

Implementation of popularity based recommended system:

○ We can implement the popularity based recommended system using the Recommender library of python.

Content Based Recommender System

○ A content based recommendation system tries to recommend items to users based on their profile.

○ The user’s profile revolves around that user’s preferences and tastes. It is shaped based on user ratings, including the number of times that user has clicked on different items or perhaps even liked those items. The recommendation process is based on the similarity between those items. Similarity or closeness of items is measured based on the similarity in the content of those items.Items in terms of category, tag, genre, and so on.

○ For Example:

■ Consider that we have 4 series.If user likes or rates the first two series.And series 3 is also similar to series 1 so the recommended engine also recommends series 3 to the user.

● How a Content based recommended system works?

○ Let’s assume we have a data set of six books.This data set shows books that our user has watched and also the genre of each of the books.

○ For example “abc” in Novel and history , “xyz” in Technology and Science and “efg” in Novel.

○ Novel,Technology,Science and History gernes.

○ Let’s say the user has read and rated three books so far and she has given a rating of two out of 10 to the first book, 10 out of 10 to the second book and eight out of 10 to the third. The task of the recommender engine is to recommend one of the three candidate books to this user, or in other words we want to predict what the user’s possible rating would be of the three candidate books if she were to watch them.

○ The task of the recommender engine is to recommend one of the three candidate books to this user.

○ For this we have to first build one vector which shows the rating on books that she has already read.

Input User Matrix

○ Then, we encode the books through the one-hot encoding approach. Genres of books are used here as a feature set.

○ We use the first three books to make this matrix, which represents the book feature set matrix.

Books Matrix

○ If we multiply these two matrices we can get the weighted feature set for the Books. Let’s take a look at the result. This matrix is also called the Weighted Genre matrix and represents the interests of the user for each genre based on the books that she’s watched.

Weighted Gerne Matrix

○ Let’s Aggregate it.

User Profile Matrix

○ It clearly indicates that she prefers Technology books more than any other genre.

○ Let’s make Books matrix for those not read by her. It is shown below:

○ Let’s multiply this matrix by User profile matrix. (Weighted Movie Matrix for unread books)

○ Let’s calculate a weighted average for each of the books those are unread.

○ It is clearly shown that the abc1 book has the highest weighted average.So it is proper to recommend to the user.

○ Such a model is very efficient. But,in some cases, it doesn’t work. For example, assume that we have a book in the geography genre, which the user has never read. So, this genre would not be in her profile. Therefore, she shall only get recommendations related to genres that are already in her profile and the recommender engine may never recommend any book within other genres. This problem can be solved by other types of recommender systems such as collaborative filtering.

Content Based Filtering

○ Let’s understand the code for the movie’s recommended system using a content based recommender system.

Collaborative Filter Recommended System

○ Collaborative filter recommendation systems use similarities between users and items concurrently to provide suggestions to address some of the drawbacks of content-based recommendation system. Collaborative filtering is based on the assumption that there are connections between goods and the desires of individuals..

○ Most recommendation systems use collaborative filtering to identify such relationships and to provide an appropriate product recommendation that the consumer may like or be interested in.

Collaborative Filtering

○ Recommended system has two approaches.

■ Item-based Recommender System

■ User-based Recommender System

○ User-based recommender system:

■ User-based recommender system is based on user similarities and neighbourhood.

■ User A, for example, has read and rated three books, a, b , c. User B have also read two books c and b and also rated.So As collaborative filtering recommended engine also recommended book a to the user A.

○ Item-based Recommender System:

In the item-based approach, similar items build neighborhoods on the behavior of users. That it is not based on their contents. For example, Item 1 and Item 3 are considered neighbors as they were positively rated by both User 1 and User 2.bThus, item 1 can be suggested to User 3 as he has shown interest in item 3 already. Hence, the recommendations here are based on the things a consumer may prefer in the neighborhood.

○ Challenges in Collaborative filtering

■ Data Sparsity:

● Data sparsity arises when we have a wide collection of users who usually only rate a small number of products

● Collaborative recommendations can only predict an item’s scoring if it has been scored by other users. Because of the sparsity, we do not have enough ratings in the dataset of user items which makes it difficult to give proper recommendations.

■ Cold Start:

● Cold start refers to the trouble that the recommendation system has when a new user is present, and as such a profile does not yet exist for them. Cold start can also occur if we have a new item that has not earned a ranking

■ Scalability:

● Scalability can become an issue as well.When the number of users or items increases and the volume of data grows, the output of collaborative filtering algorithms may begin to drop performance simply due to growth and the similarity computation.

○ Below are two types of collective filtering implementations.

■ Model based implementation:

● A model of users is developed in model-based methods, in an effort to learn their preferences. Models can be developed using techniques of machine learning such as regression, clustering , classification and so on.

■ Memory based implementation:

● Through memory-based approaches, we create a recommendation system with the entire user-item dataset. It uses statistical techniques to approximate users or items. Examples of these techniques are Pearson Correlation, Cosine Similarity and Euclidean Distance, among others.

○ Implementation of collaborative filtering:

Hybrid Model:

● To overcome the drawback or challenges of content based recommender system and collaborative recommended system Hybrid model is used.

● Hybrid recommended systems combine two or more recommendation strategies into different ways to get more benefits.

● The main purpose of the hybrid model is to take advantages of different types of recommended system.

● Most commonly,collaborative filtering is combined with some methods(recommended strategy) that have been employed.

Hybridization Methods:


■ To produce a single recommendation system the scores( or votes) of different recommendation techniques are combined.


■ Based on the current situation the system switches between recommendation techniques.


■ Recommendations from several different recommenders are presented at the same time.

Feature combination:

■ Features from different recommendation data sources are thrown together into a single recommendation system.


■ One recommender refines the recommendation given by another.

Feature augmentation:

■ Output from one technique is used as an input feature to another.


■ The model which one recommender has learned is used as input to another.

If you liked the story and want to appreciate us you can clap as much as you can. Appreciate our work by your constructive comment and also you can connect to us on….


LinkedIn :


Website :