MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / dcg

Function dcg

experiments/benchmark/evaluate_benchmark_predictions.py:45–51  ·  view source on GitHub ↗
(items: list[Any], gain_fn: Callable[[Any], float])

Source from the content-addressed store, hash-verified

43
44
45def dcg(items: list[Any], gain_fn: Callable[[Any], float]) -> float:
46 score = 0.0
47 for rank, item in enumerate(items, start=1):
48 gain = float(gain_fn(item))
49 if gain > 0:
50 score += gain / math.log2(rank + 1)
51 return score
52
53
54def reciprocal_rank(items: list[Any], gain_fn: Callable[[Any], float]) -> float:

Callers 1

evaluate_episodeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected