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

Function dcg

experiments/benchmark/evaluate_simulation_metrics.py:86–93  ·  view source on GitHub ↗
(rows: List[Dict[str, Any]], gain_fn)

Source from the content-addressed store, hash-verified

84
85
86def dcg(rows: List[Dict[str, Any]], gain_fn) -> float:
87 score = 0.0
88 for idx, row in enumerate(rows, start=1):
89 gain = float(gain_fn(row))
90 if gain <= 0:
91 continue
92 score += gain / math.log2(idx + 1)
93 return score
94
95
96def reciprocal_rank(rows: List[Dict[str, Any]], gain_fn, k: int) -> float:

Callers 1

evaluate_episodeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected