Collaborative Filtering Algorithm

827 Views Asked by At

If I have the following users with the following ratings for movies they watched:

User1 Movie1-5 Movie2-4 
User2 Movie2-5 Movie2-3 Movie3-4
User3 Movie1-4 Movie2-4 Movie4-4

How would I use collaborative filtering to suggest movie3 to user1 and how do I calculate the probability of user1 giving movie3 a 4 or better?

2

There are 2 best solutions below

0
AudioBubble On

Well there are a few different ways of generating recommendations using collaborative filtering, I'll explain user-based and item-based collaborative filtering methods. These methods are most used in recommendation algorithms.

User-based collaborative filtering

This basically calculates a similarity between users. The similarity can be a pearson correlation or cosine similarity. There are more correlation numbers, but those are most used. This article gives a good explanation on how to calculate this.

User-based filtering does come with a few challenges. First is the data sparsity issue, this occurs when there are a lot of movies with a few reviews. This makes it difficult to calculate a correlation between users. This wikipedia page explains more about this.

Second is the scalability issue. When you have millions of users with thousands of movies, the performance of calculating correlations between users is going to drop tremendously.

Item-based collaborative filtering

This method differs from user-based filtering because it calculates a similarity between movies instead of users. You can then use this similarity to predict a rating for a user. I have found that this presentation explains it very well.

Item-based filters have outperformed user-based filters, but they also suffer from the same issues, but a little less.

Content-based filtering

Seeing your data, it's going to be difficult to generate recommendations because you have too little data from users. I would suggest using a content-based filter until you have enough data to use collaborative filtering methods. It's a very simple method which basically looks at the user's profile and compares it to certain tags of a movie. This page explains it in more detail.

I hope this answered some of your questions!

0
jadar_m On

You can either calculate similarity between users or among items. Some easy methods to find similarity are 'cosine similarity', 'Pearson similarity'. enter image description here

This GFG page explains user-based approach, with an example to find similarity among users, and thus make predictions on items they didn't watch yet.