← Lessons

quiz vs the machine

Gold1350

Machine Learning

Item Based Collaborative Filtering

Recommend items similar to ones you already liked, where similarity comes from co interaction.

5 min read · core · beat Gold to climb

A more stable view

Item based collaborative filtering flips the user based approach. Instead of finding users like you, it finds items like the ones you liked, where item similarity is computed from how users co interact with them, not from attributes.

Why flip it

Item relationships are far more stable than user tastes. Two items that are rated similarly by many users stay similar over time, while a single user changes mood week to week. This stability lets you precompute an item item similarity matrix offline and reuse it.

How similarity is defined

  • Treat each item as a column vector of all user ratings.
  • Compute cosine or adjusted cosine similarity between item columns.
  • Adjusted cosine subtracts each user mean first, removing the fact that some users rate everything high.

Serving a recommendation

For a target user, gather items they rated. For each candidate item, score it as a similarity weighted blend of the user ratings on the items most similar to it. Sort and return the top.

Tradeoffs

  • More scalable to precompute and cache than user based.
  • Still sparse, and popular items can dominate the similarity lists.

Key idea

Item based collaborative filtering recommends items similar to your past picks using co interaction similarity, which is stable and cacheable.

Check yourself

Answer to earn rating on the learn ladder.

1. Why is item based filtering often preferred over user based at scale?

2. What does adjusted cosine similarity correct for?

3. How is item to item similarity computed here?