Collaborative Filtering: User-Based and Item-Based
User similarity, item similarity, neighborhood methods, cosine similarity for ratings.
What Is Collaborative Filtering?
Collaborative filtering (CF) recommends items by learning from the behavior of many users. The core idea: people who agreed in the past tend to agree in the future. It needs no item descriptions, only the interaction history.
The User-Item Matrix
CF starts from a user-item matrix where rows are users, columns are items, and each cell holds a rating (or blank if unrated). This matrix is usually very sparse since each user rates few items.
import pandas as pd
matrix = ratings.pivot_table(
index="user_id", columns="item_id", values="rating"
)All lessons in this course
- Collaborative Filtering: User-Based and Item-Based
- Matrix Factorization with SVD
- Content-Based Filtering
- Hybrid Systems and Evaluation Metrics