All lessons in Machine Learning Engineering: Reliable Predictive Models
Ranking and Recommendation Evaluation
Calculate ranking metrics and audit candidate sets, exposure, and negative sampling.
30 minutes · Members lesson · preview
What you will learn
- Compute precision at k, recall at k, average precision, NDCG and reciprocal rank by hand for a ranked list of parcels.
- Explain how the candidate set, the capacity limit k and past exposure decisions change what a ranking metric means.
- Diagnose when sampled negatives inflate a hit metric and state how to report the result honestly.
A late-delivery model at dispatch is rarely used as a plain yes-or-no classifier. The hub team that can re-route a parcel or phone a customer ahead has limited time per dispatch wave, so what they actually consume is a priority list: the parcels the model thinks are most likely to be late, sorted from most to least likely, cut off at whatever the team can handle. The question is no longer whether a probability crosses a threshold but whether the right parcels sit near the top. This lesson shows how to score an ordering, and then turns to the quieter problems that decide whether such a score means anything: which parcels were in the list at all, how earlier interventions shaped the labels, and what happens when evaluation negatives are sampled rather than complete. A second toy setting, recommending a delivery time slot to a customer, is used where the parcel-priority case does not fit.