5/31
Part 1 of 6 · DCGLearn and do
Rank 1 divides by log2 of 2, and an off-by-one breaks DCG
The one-line dcg_at_k has one easy place to slip: the discount at rank 1.
In the editor, write dcg_rows(rels, k): dcg_at_k for many queries at once, with the discount right. rels is a 2-D array with one row of grades per query, in ranked order, and you return the DCG@k of every row.