Closed mmosc closed 2 years ago
A new branch has been opened to fix the issue. We can contribute directly there and then review the merge request. Thanks for the contribution :smile:
@mmosc on https://doi.org/10.1007/s13735-018-0154-2 the Novelty formula seems to be
top_n = top_n.groupby('user')['rank'].apply(lambda x: np.sum(-np.log2(x)))
In brief, we sum the logarithm of the top_n items reciprocal of the popularity score for each user and then compute the mean. Is that correct?
Hi @giuliowaitforitdavide ! Since [according to the definition you quoted]() we first need to average over the top k elements and then over the users, I think it should be:
top_n = top_n.groupby('user')['rank'].apply(lambda x: np.mean(-np.log2(x)))
return top_n.mean()
Do you agree?
Cheers! Marta
Hi! Thanks for the great library :)
I think there is a bug in the formula for novelty: currently, it is
top_n = top_n.groupby('user')['rank'].apply(lambda x: - np.log2(1 / x))
this is equivalent totop_n = top_n.groupby('user')['rank'].apply(lambda x: np.log2(x))
withx
being a measure of the popularity of the item (i.e., higherx
means a more popular item). This means that ifx
is always high (i.e., if popular items are recommended), novelty will be high, while the opposite should be the case, instead.Solution:
top_n = top_n.groupby('user')['rank'].apply(lambda x: - np.log2(x))
or equivalentlytop_n = top_n.groupby('user')['rank'].apply(lambda x: np.log2(1 / x))
Cheers! Marta