Course contentsShow
← Machine Learning and Deep Learning
Lesson 2353 of 3,53851. Recommender SystemsFree lesson

User-Based Collaborative Filtering

Finding similar users and aggregating their ratings to predict preferences for the target user.

User-Based Collaborative Filtering

What You'll Learn

You'll learn how to predict a user's preferences by finding similar users and aggregating their ratings.

The Core Idea

User-based collaborative filtering operates on a simple but powerful principle: people who agreed in the past tend to agree in the future. If you and I both loved the same five movies, and I recently watched a sixth movie and loved it, there's a good chance you'll enjoy it too.

The algorithm works in three steps:

  1. Find similar users: Using similarity metrics (like cosine similarity or Pearson correlation, which you've already learned), identify users whose rating patterns most closely match the target user's.

  2. Filter by relevance: Focus on the k most similar users (nearest neighbors) who have rated the item you're trying to predict.

  3. Aggregate ratings: Combine these similar users' ratings—often using a weighted average where more similar users contribute more heavily to the prediction.

The Prediction Formula

For predicting user u's rating on item i:

predicted_rating(u, i) = weighted_sum of (similarity(u, v) × rating(v, i)) / sum of similarities

where v ranges over the k most similar users who rated item i.

Practical Analogy

Think of it like asking your closest friends for restaurant recommendations. You don't ask everyone in town—you ask friends whose taste matches yours (high similarity). And if your best foodie friend raves about a place, you weight their opinion more heavily than an acquaintance's.

Challenges

User-based collaborative filtering struggles with scalability—comparing one user against millions is computationally expensive. It also requires updating similarities as new ratings arrive.

Key Takeaway: User-based collaborative filtering predicts preferences by finding users with similar rating histories and using their ratings as proxies for what the target user might like.