Recommender systems from the ground up
Rank a catalogue for one user at a time
- Intermediate
- 10 chapters
- 165 min read
How a recommender turns a catalogue into an ordered list: popularity baselines, content profiles, item and user neighbourhoods, matrix factorisation, implicit feedback, two-tower retrieval, online evaluation and the ranking metrics that keep the comparison honest. Every example is plain Python on a small hand-written dataset, and the capstone evaluates a hybrid recommender on a temporal split.
What You'll Learn
- Frame a recommendation as a ranking task with a cutoff and a metric
- Build a popularity baseline and a content-based profile
- Find item and user neighbours in an interaction matrix
- Fit latent factors with biases by gradient descent
- Handle implicit feedback with confidence and sampled negatives
- Read precision at k, MAP and nDCG and know what each one hides
- Diagnose cold start and the feedback loop that narrows a catalogue
- Build a two-tower retriever and measure recall at k
- Design an online test with a guardrail and a fixed horizon
- Evaluate a hybrid recommender on a temporal split and report coverage
Prerequisites
- Comfortable with Python lists, dictionaries and functions
- Basic arithmetic: averages, dot products and square roots
- No ML library is needed — every example is plain Python
Vocabulary
The terms the chapters assume, in plain words.
- cold start
- The problem of recommending for a new user or a new item that has no interactions yet.
- collaborative filtering
- Recommending items by finding users with similar taste, or items that similar users liked, without reading item content.
- explicit feedback
- A signal where the user states a preference, such as a rating or a like, rather than one inferred from behaviour.
- implicit feedback
- A signal inferred from behaviour, such as a click, watch or purchase, that says something happened but not how much it was liked.
- matrix factorisation
- A method that gives each user and item a short list of learned numbers, so their match is the sum of products.
- nDCG
- A ranking score that gives more credit to relevant items near the top, then divides by the score of the best possible order.
- popularity baseline
- A list ordered by how many interactions each item has, used as the simple result every model must beat.
- precision at k
- The share of the first k items that are relevant, where k is the number of slots shown.
- ranking
- The second stage that orders a short list of candidates for one user, usually with a slower model.
- recall at k
- The share of all relevant items that appear in the first k positions.
- relevance
- How likely one user is to engage with one item; a ranking needs it per user, not as a global score.
- retrieval
- The first stage that cuts a large catalogue down to a few hundred candidates cheaply.
- slot
- One position on the screen that can hold an item; the fixed count of them limits how long a list can be.
- two-tower retrieval
- A design with one network for users and one for items, so the item side is computed before a request.
Course Content
- 01The ranking problemNot started
A recommender is not a classifier with many labels. It orders a catalogue for one user at one moment, and the order is the product.
- 02Content-based filteringNot started
Content-based filtering turns items into feature vectors and a user into the average of what they liked. It works before anyone else has interacted.
- 03Collaborative filteringNot started
Collaborative filtering needs no item features. It finds neighbours in the interaction matrix and lets the crowd stand in for the description.
- 04Matrix factorisationNot started
Matrix factorisation gives every user and item a short vector of latent factors and fits them to the ratings that exist. The empty cells become a dot product.
- 05Implicit feedbackNot started
Clicks and plays have no negative examples. Implicit recommenders learn from confidence in what happened, and from negatives they sample themselves.
- 06Ranking metricsNot started
Precision at k, MAP and nDCG answer different questions about a list. Pick the one that matches what the interface promises.
- 07Cold start and feedback loopsNot started
New users, new items and a new product each break a different assumption. Exploration is how a recommender learns what it was never shown.
- 08Two-tower retrievalNot started
Retrieval turns a catalogue of millions into a few hundred candidates. Two towers and a nearest-neighbour index are how that stays cheap, and the split is also the model’s main constraint.
- 09Online evaluationNot started
Offline metrics filter bad models; online tests decide what users actually do. Randomisation, a pre-registered metric and a fixed horizon are what make the answer trustworthy.
- 10Capstone: a recommender and its evaluationNot started
A complete small recommender: a temporal split, a popularity baseline, item-item CF, a content fallback and an honest offline report.
