9/31
Part 2 of 6 · NDCGLearn and do

Ties in the scores need a fixed rule

A ranker gives each item a score, and the page sorts by it. When two items tie, which one goes first is arbitrary, and the metric moves with it:

print(round(ndcg_at_k([3, 0, 2], 3), 4))
print(round(ndcg_at_k([3, 2, 0], 3), 4))
Predict

Items score 0.9, 0.5 and 0.5, with grades 3, 0 and 2. What is NDCG@3 with the grade 0 first among the tie, then with the grade 2 first?

Pick one to see what it prints.
Pick an answer above to see the rest