Skip to content

Commit 9c48f70

Browse files
committed
add negative gains clipping in NDCG to docs
1 parent b7b5a74 commit 9c48f70

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/lenskit/metrics/ranking/_dcg.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ class NDCG(ListMetric, RankingMetricBase):
4545
\\mathrm{nDCG}(L, u) & = \\frac{\\mathrm{DCG}(L,u)}{\\mathrm{DCG}(L_{\\mathrm{ideal}}, u)}
4646
\\end{align*}
4747
48+
.. note::
49+
Negative gains are clipped to zero before computing NDCG.
50+
This keeps the metric bounded between 0 and 1 and prevents cases where
51+
negative gains can lead to misleading positive scores due to
52+
cancellation effects.
4853
Args:
4954
n:
5055
The maximum recommendation list length to consider (longer lists are

0 commit comments

Comments
 (0)