User-Based Collaborative Filtering
User-based collaborative filtering finds users whose rows in the utility matrix resemble the target user’s row, then recommends what those neighbors liked. It is the most literal form of collaborative filtering: “people with histories like yours also liked this.”
User-user prediction
With similarity , a rating-style prediction is
For binary interactions, the numerator is often just a weighted sum of neighbor item indicators. Item-based collaborative filtering flips the similarity computation to columns.
Worked example
For target user U0 with ratings , cosine similarity compares U0’s rating vector with each other user’s vector:
| User | Ratings | Similarity to U0 | Contribution to unseen items |
|---|---|---|---|
| U0 | 1.000 | Target user; already-seen items are filtered. | |
| U1 | 0.964 | Strong neighbor; contributes to item 2. | |
| U2 | 0.096 | Weak neighbor; contributes little. | |
| U3 | 0.000 | No overlap with U0’s rated items. |
After filtering items 0 and 1, item 2 receives the strongest neighbor-weighted support because the nearest user rated it. Matrix factorization can be viewed as replacing this local neighbor lookup with a global low-rank model.
Caveats
User neighborhoods are unstable when users have few interactions or rapidly changing tastes. Computing user-user similarities is expensive in systems with many users. New users need onboarding, content-based recommendation, or exploration before neighbor scores are meaningful.
References
- scikit-learn documentation: cosine_similarity
- Adomavicius and Tuzhilin, 2005, Toward the Next Generation of Recommender Systems
Nav