promptdojo_

Mission: tiny recommender — step 1 of 7

Mission: the tiny recommender

"Users who liked X also liked Y" may be the most commercially familiar sentence in ML — and you can build the real thing from raw events with nothing but counting. Start with the crudest version that ranks at all, push one awkward catalog through it, then teach it manners at the edges.

The job: a working "users who liked X also liked Y" recommender from raw events — the unsupervised arc's ideas earning their keep in the most commercially familiar shape there is.

The stages:

  1. Co-occurrence core — the starter: for a given item, count which other items share users with it. That count is a crude similarity — run it and read the ranking.
  2. Normalize — raw counts favor popular items (everything co-occurs with a blockbuster). Divide by each candidate item's total user count and watch the ranking change: that's the difference between "popular" and "related," and it's the mission's key lesson.
  3. Cold start — recommend for an item with no history. Your code must degrade gracefully (fall back to global top items and say so), not crash or return nothing silently.
  4. Stress case — add a power user who liked everything; show whether they smear all items together, and guard it (cap per- user contribution).
  5. One improvement — user-level recommendations (union of recs for their items, minus what they've seen), an embedding-based similarity fallback for cold items, or an eval: hide one liked item per user and measure how often the recommender surfaces it (that hidden-item check is chapter 21's eval discipline, recommender edition).

End to end: raw (user, item) events go in; ranked, explainable recommendations come out — and the edge cases fail out loud instead of quietly.