THUDM / ComiRec

Source code and dataset for KDD 2020 paper "Controllable Multi-Interest Framework for Recommendation"

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

计算NDCG

GuoshenLi opened this issue · comments

在master branch中的95到97行计算idcg的过程当中
idcg = 0.0
--------for no in range(recall): # 原来的代码
for no in range(len(true_item_set)): # 我觉得应该要遍历len(true_item_set) 次
idcg += 1.0 / math.log(no+2, 2)

请问我的理解有错误吗?否则按照您原来的代码,假设我的ture_item_set 有5个商品,那么我topn推荐出来如果中了1个或者2个(简单起见都假设排在了top1和top2),这两种情况计算的最终ndcg是一样的(都为1)。但是显然不应该一样。