System Design · step by stepDesign a Recommendation System
Step 1 / 9
RUN IT YOURSELF

Item-based collaborative filtering

"Because you liked X" works by finding items similar to ones you already liked — item-item cosine similarity over a rating/feature matrix. Here it is in real Python, running live. Read the comments, edit the catalog, and hit Run.

HOW TO READ THE CODE — 4 IDEAS
  1. Each item is a feature vector (here: how action / comedy / romance it is).
  2. Two items are similar if their vectors point the same way — cosine similarity.
  3. Score each unseen item by its best similarity to something you liked (steps 1–2).
  4. Recommend the top-k, never re-suggesting what you have seen (step 3).
CPython · WebAssembly
built to be reasoned about, not memorized — make the calls, stale the features, run the quiz.
Finished this one? 0 / 5 AI System Designs done

Explore the topic

See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.

More AI System Designs