dcg ( scores -- dcg ) (original) (raw)
dcg ( scores -- dcg )
Statistics
Prev: | Computing cumulative sequences |
---|---|
Next: | ndcg ( scores -- ndcg ) |
Vocabulary
math.statistics
Inputs
scores | a sequence |
---|
Outputs
dcg | a number |
---|
Word description
Calculates the discounted cumulative gain from a list of scores. The discounted cumulative gain can be used to compare two lists of results against each other given scores for each of the results.
See https://en.wikipedia.org/wiki/Discounted_cumulative_gain
See also
ndcg
Definition
USING: kernel math math.functions math.vectors ranges sequences
;
: dcg ( scores -- dcg )
dup length 1 + 2 swap [a..b] [ log 2 log /f ] map v/ sum ;