promptdojo_

Mission: tiny recommender — step 7 of 7

Checkpoint

One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.

Build the hidden-item eval — chapter 21's hide-the-answer habit, recommender edition. For each user (alphabetical order): hide their alphabetically-first item, then recommend from the REMAINING items — recommend_for_user(user, visible) scores every item other users have alongside any visible item (skip the user themselves, count co-occurrences, sort by count then name, exclude the visible items). Print one line per user: f"{user}: hid {hidden!r}, top-2 recs {recs[:2]}, hit={hit}" (hit = hidden item in the top 2), then f"hit rate: {hits}/{len(by_user)}".

full-screen editor opens — close anytime to keep reading.