Discounted Cumulative Gain
Given relevance grades, return DCG@k using gain / log2(rank+1), rounded to six decimals.
Examples
EXAMPLE WALKTHROUGHfirst
A guided view of the published example, not a trace of your code.
INPUT
[[3,2,1],1]TASKdcg_at_k()
EXPECTED OUTPUT
3Start with the input values shown in this example.
Example 1 of 2
Input: relevances = [3,2,1], k = 1
Output: 3
Explanation: first
Input: relevances = [1,1], k = 2
Output: 1.63093
Explanation: two ranks
Hint 1
Ranks are one-based; the denominator is log2(rank + 1).