KatInterview

Build a "You May Also Like" Item-to-Item Recommender

Machine LearningModel answer
EasyModel answerMachine Learningmachine learningrecommendation systemscollaborative filtering

Last updated

Design and evaluate a simple item-to-item collaborative filtering system for an e-commerce platform recommending related products on a product detail page.

Background

You are a junior ML engineer at an online retail platform. The product team wants to add a "You May Also Like" widget on every product detail page. When a user views a pair of running shoes, the widget should show 5–10 other items they are likely to buy.

You have access to:

  • Purchase history: 50 million (user, item, timestamp) transaction records over 2 years
  • Item catalog: 500,000 SKUs with category, price, and title
  • Page-view logs: which items each user viewed (without buying)

What is expected

Walk the interviewer through building a first version of this system end-to-end:

  1. Problem framing – What exactly are you predicting? What signal will you use?
  2. Data preparation – How do you turn raw logs into a usable dataset?
  3. Model choice – What algorithm would you use for v1 and why?
  4. Evaluation – How do you measure success offline and online?
  5. Failure modes – What can go wrong, and how do you mitigate it?

No need to write code. Explain your reasoning clearly, mention trade-offs, and flag common pitfalls.

Hints

Hint 1

Think about what 'similarity' means in a co-purchase context — which pairs of items appear together in the same basket or session?

Hint 2

For evaluation, consider both an offline ranking metric and an online business metric, and explain why they might disagree.

Hint 3

Cold-start is a classic problem here — how would you handle a brand-new item with zero purchase history?