Ch.12

Collaborative Filtering: Recommendation Basics

Have you ever seen 'You might also like' on Netflix? Collaborative filtering recommends items that users with similar tastes liked. This chapter covers the rating matrix, similarity, neighbor-based prediction, and how it is used in practice.

ML diagram by chapter

Select a chapter to see its diagram below. View the machine learning flow at a glance.

From the user-item rating matrix, find similar users (neighbors) and predict missing entries using their ratings.

① Find neighbors → ② Use their ratings → ③ Predict empty cell → ④ RecommendNeighbors' ratings for this item → fill in my predicted ratingNeighbor 1★ 5This item?Neighbor 2★ 4평균 계산Similar users gave this item ★5, ★4 → we recommend ★4!
Avg prediction: r^u,i=5+42=4.54\hat{r}_{u,i}=\frac{5+4}{2}=4.5\approx4 (neighbors rated ★5 and ★4) → predict ★4

Collaborative filtering: predict r^u,i\hat{r}_{u,i} from similar users.

Recommendation basics: Collaborative filtering

What is collaborative filtering? — It uses other users' behavior (ratings, clicks, purchases) to recommend items to you. The idea is that people with similar tastes tend to like similar things. It is widely used in streaming, e-commerce, and music apps.
Intuition: borrowing from neighbors — For movie recommendations, if someone who liked the same movies A and B as you also liked C, you might like C. Those similar users are neighbors, and predicting from their ratings is the core of collaborative filtering.
Math: rating matrix and prediction — The rating matrix has size (users × items); many entries are missing (sparse). User-based collaborative filtering finds neighbors of user uu, then fills a missing rating for item ii with a weighted average of the neighbors' ratings. Similarity is often measured by cosine similarity or Pearson correlation.
In practiceCold start (new users/items have no neighbors) and sparsity make pure collaborative filtering hard, so it is often combined with content-based methods or matrix factorization.
Recommendations drive business and UX — Good recommendations increase engagement and revenue. Collaborative filtering personalizes results using behavior data alone, without rich metadata.
Core ML application — Recommendation is a different kind of problem: we fill in missing entries of a matrix. Understanding collaborative filtering is a step toward matrix factorization and deep learning-based recommenders.
User-based vs item-basedUser-based: find users similar to you and recommend what they liked. Item-based: find items similar to the one you are viewing ('Users who bought this also bought'). Both use similarity and neighbors.
Similarity and prediction — Similarity su,vs_{u,v} between users is computed, then prediction uses a weighted average of neighbors' ratings. Metrics like MAE and RMSE are used for evaluation.
Matrix factorization — Advanced methods approximate the rating matrix by a product of lower-rank matrices. Hybrid systems combine collaborative filtering with content or context.
This chapter covered collaborative filtering, the basis of recommendation systems.
- Collaborative filtering: Uses other users' behavior (ratings, clicks, purchases) to find neighbors (similar users) and predict missing ratings.
- Rating matrix: Rows = users, columns = items. One cell = one user's rating for one item. Most cells are empty (sparse matrix).
- Prediction flow: Compute similarity → select K neighbors → predict with simple average or weighted average (using similarity as weight) to get r^u,i\hat{r}_{u,i}.
- In practice: Cold start and sparsity are often addressed with content-based methods, matrix factorization, or hybrid systems.