We often use different platforms like Netflix, Amazon, or YouTube where the system recommends us 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. If we go for some example, a recommender system is like one of our friends who give us recommendations on a book or movie based on our behavior.
Same as Machine Learning models, recommendation system works based on historical user behaviors. Recommender systems have mainly two categories, item-based collaborative filtering, and user-based filtering.
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 uses 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.
Document Similarity: 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.