Get this book -> Problems on Array: For Interviews and Competitive Programming
We are seeing an unprecedented rise in the use of the recommendation system in various services. Be it Youtube, Amazon, Netflix, advertisement, or an e-commerce site, these systems are unavoidable in our online journey. They aim to predict users' interests and suggest products that they might like according to their interests. Machine Learning approaches are common in Recommendation System.
Why do we need recommendation system?
They give users a lot of options which he or she might not have even discovered yet. It expands the interests of a user by suggesting them new movies, videos, items to buy, etc. So, we can conclude that the recommendation system in one way or another increases the revenue of the company by giving users choices and expanding and exploring the interest of the user which he or she might feel difficult to explore on its own. As they are very important for generating larger revenues, it is very critical in the industry. For example, Netflix organized a challenge where the goal was to produce a better recommendation system which beats their own algorithm with a prize of 1 million dollars.
How does a recommendation system work?
Recommendation system needs to kind of information to function:
- Characteristic information: This is information about items such as keywords, categories, etc and information about users such as profiles, preferences, etc.
- User and item interactions: This is information about likes, number of purchases, reviews, ratings, etc of an item.
Using these, the recommendation system can use three types of recommendation algorithms:
- Content-based systems: It uses characteristic information.
- Collaborative filtering systems: It is based on user-item interactions.
- Hybrid systems: It combines the above two recommendation systems.
Content-based recommendation system
In this type of recommendation system, the user’s item, and profile feature are used. It says that if a user got interested in a type of item in the past, he/she will again get interested in the future. For example, if a user likes a comedy movie, then chances are high that he will watch another comedy movie if recommended.
Working of content-based recommendation system
Information about the user is saved in the form of vector i.e., the movies he liked or disliked or the ratings that were given by them and so on. This vector is called the user's profile vector. Information regarding each movie/video/item are stored in another vector which is called an item vector.
The content-based recommendation system algorithm finds the cosine of the angle between the profile vector and item vector, i.e. cosine similarity. For Example, if the profile vector is A and the item vector is B, then the similarity between them can be calculated as:
As cosine values range from -1 to 1, items are arranged in descending order one below the other. Generally, only the top 'n' items are recommended to the user. In some cases, a threshold is set and all items above that threshold are shown to the user.
One major downside of using this algorithm is that it recommend items that are similar. It never recommends item that the user has not seen/bought before. For Example, if a user watches comedy movies, this algorithm will only recommend comedy movies.
To improve upon this drawback, another algorithm that can recommend items not solely based on the content, but the behavior of users as well.
Let us understand this with an easy example. If person A likes 3 movies, say x,y and z, and person B likes x,y and q, then we can say that these people have similar interests. Hence, we can recommend z to B and q to A.
Collaborative Filtering algorithms are two types:
User-User based: This algorithm first finds the similarity score between different users. Based on this similarity score, it then picks out the most similar users among the pool and recommends products that these similar users have liked or bought previously.
Item-Item based: This algorithm looks for items that are similar to the items that the user has already watched/rated and recommend most similar items. It might look similar to content-based recommendation system, but it is different. Let us understand item-item similarity clearly. It doesn't matter if two items are the same by attributes such as two movies under the comedy genre. Instead, what similarity means here is how people treat two items the same in terms of watch/rating. So, a user might like (gave a higher rating) two different movies from two different genres such as comedy and action. So, these two different movies have a higher item-item similarity.
The diagram below depicts the difference between User-User and Item-Item based recommendation system.
Evaluation metrics for recommendation engines
As for any algorithm, there is a need for us to be able to evaluate the performance of our recommender systems. This helps us to decide which algorithm fits best for any specific situation.
- Recall: Proportion of items that are actually liked by the user among all the items that were recommended.
'tp' represents the number of items recommended to a user that he/she likes and 'tp'+'fn' represents the total items that the user likes.
- Precision: Out of all the recommended items recommended to a user, how many did the user actually like
'tp' represents the number of items recommended to a user that he/she likes and 'tp'+'fp' represents the total items recommended to a user
- Recommendation system is very important for many big companies as it helps in exploring the interests of the user. It also increases the revenue of companies to a huge extent.
- Recommendation systems can be divided into two sections: content-based approaches that use prior information about users and items, and collaborative approaches (such as item-item, user-user) that are only based on user-item interaction
- Recommender systems are difficult to evaluate: some classical metrics are recall or precision which can be used. Real-world conditions of evaluation (such as A/B testing) is finally the only real way to evaluate a new recommendation system.
With this article at OpenGenus, you must have a strong idea of recommendation systems and how it works. Enjoy.