Discover more from uniqin.ai’s Newsletter
Cosine Similarity for Item Based Collaborative Filtering
by Saikat Mazumder
We often use different platforms like Netflix, Amazon, or YouTube where the system recommends videos or products based on the watch history or buying pattern. This is part of the recommendation system. By definition, a recommendation system is an information filtering system that predicts a user’s preference over an item. For example, a recommender system is like one of our friends who gives us recommendations on a book or movie based on our behavior.
Same as Machine Learning models, the recommendation system works based on historical user behaviors. Recommender systems have mainly two categories, item-based collaborative filtering, and user-based filtering.
User-Based Collaborative Filtering
It is based on finding the similarity of the users to the target user. The target user’s behavior may be very similar to some of the users and may not match with other user’s behavior.
Item Based Collaborative Filtering
Item-based filtering is calculated based on two items’ similarities. Cosine Similarity is one such technique to calculate the similarity between two products.
Item-based similarity doesn’t imply the similarity of two item’s properties but it is based on the similarity of the user affinity. Companies like Amazon use item-based filtering for better customer experience and proper recommendation of products.
Cosine similarity is the measure of the cosine of the angle between two vectors in an n-dimensional space. It is the measurement of how similar two products or two documents are irrespective of their shape or size. It is the dot product of the two vectors divided by the two vectors’ magnitude.
Cosine similarity is expressed by the below equation
The value of cosine varies from -1 to +1 where the -1 value refers to items that are opposite in nature and +1 refers to the item which are very similar.
If we look at the cosine value, the value is 1 when theta is 0 and the value is -1 when theta is 180. So, the value is highest for the overlapping vectors and lowest when they are exactly opposite.
Use case of Cosine Similarity
Here are some use cases of cosine similarity.
Item to Item collaborative filtering
Cosine similarity is used to implement item to item collaborative filtering. This is a popular product similarity generation technique for e-retailers and other businesses. This is used to recommend products to the customers, finding product bundles, and more.
Cosine similarity is very useful for comparing documents and their similarity. The documents are first vectorized as per the content and then the vectors are used to find the similarity between them.
Pose Matching in Deep Learning
It is a process where related position and orientation of image or moving image has been calculated based on image processing techniques by using a Deep Learning algorithm.
Loved the blog? Do check out another awesome blog by Saikat Mazumder on Dynamic Pricing And How It Helps Reshape Businesses.
Struggling to price your products? Book a demo with our pricing experts now!!