MODULE 13 ยท Middle-track ยท 2.5 hours

The model learned that phones go with cases, knowing nothing about products

Matrix factorisation splits purchase history into tastes and properties. Product affinity falls out of the numbers, not out of the descriptions.

Open this module in the simulator All 23 lessons

The first two modules are free, no card. The rest are $20/month.

๐Ÿข The situation

The big quarterly project. Victor (CTO) at kickoff:

"The 'You may also like' block on the home page drives 4% of revenue, and right now it's just the bestseller list, identical for everyone. Competitors do personalization and grow conversion by 15โ€“20%. We're building our own recommender. Dataset: 2M users, 300K products, view and purchase history."

Lena assigns the roles: you own the candidate model and the offline metrics.

๐ŸŽฏ Your task

  1. Understand the approaches: popularity, collaborative filtering, content-based.
  2. Master matrix factorization (ALS) and implicit feedback.
  3. Measure ranking quality: precision@k, recall@k, NDCG.

๐Ÿ“š Theory

The three families of recommenders

  1. Non-personal: bestsellers, trends. The baseline that must be in every comparison. Often the only option for new users.
  2. Collaborative filtering (CF): "similar users buy similar things". Works purely on behavior; needs no product descriptions. Weakness โ€” the cold start (a new product/user without history).
  3. Content-based: recommend similar by attributes (category, brand, description text, image). Solves the product cold start.

Production systems are hybrids with a two-stage architecture: first a light model selects hundreds of candidates (retrieval), then a heavy model ranks them precisely (ranking). That's how YouTube, Amazon and every large marketplace work.

Matrix factorization

The "users ร— products" interaction matrix is gigantic and 99.99% empty. The idea: decompose it into the product of two narrow matrices โ€” user embeddings U (nร—k) and product embeddings V (mร—k), k โ‰ˆ 32โ€“256. A product's score for a user = the dot product of their vectors. Similar tastes โ†’ nearby vectors.

Matrix factorization: R โ‰ˆ U ร— Vแต€ โœ“โœ“โœ“โœ“โœ“โœ“ R: users ร— products (99.99% empty) โ‰ˆ U: users ร— k tastes ร— Vแต€: k ร— products ("traits") product score = user vector ยท product vector k โ‰ˆ 32โ€“256 latent factors: similar tastes โ†’ nearby vectors
We decompose the giant sparse interaction matrix into two narrow ones: user and product embeddings. A recommendation = the nearest products in taste space.

Explicit vs implicit feedback

Ranking metrics

The user sees the top-K (say, 10 slots) โ€” what matters is the top of the list:

Validation โ€” by time: train on history up to date T, evaluate on purchases after T.


What to remember

  • The "bestsellers" baseline belongs in every comparison.
  • CF learns from behavior; implicit โ‰  explicit feedback โ€” use ALS/BPR.
  • Ranking metrics: NDCG@k, precision@k; time-based validation.
  • Production is a hybrid + two stages (retrieval โ†’ ranking) + an A/B test.

Next in this module: Practice: ALS on implicit data

Open the module โ†’

Nearby lessons

12 Who are our customers, really? 14 The warehouse is overstocked: demand forecasting

The whole program โ€” 23 lessons