librec
librec copied to clipboard
Suspicious bug within AbstractRecommender.java may lead to print incorrect results
Hi,
I am new to LibRec. When playing around with the system I noticed that the recommend items it gives in output files are always identical regardless which ranking algorithm I used. So, I read through the source code and spotted these codes below which may not make sense.
https://github.com/guoguibing/librec/blob/63f8a733cc10127abcfd35dc91e16daf7970302a/core/src/main/java/net/librec/recommender/AbstractRecommender.java#L225
The method being called within parenthesis seems to be getKey()
rather than getKeyIdx()
, since keyIdx
only depicts the index of key
in the subclass below.
https://github.com/guoguibing/librec/blob/63f8a733cc10127abcfd35dc91e16daf7970302a/core/src/main/java/net/librec/recommender/item/RecommendedList.java#L285-L334
This would cause mismatch when interpreting a key
to a real itemId
and finally the itemId
s in results files are always the same. However, LibRec is a complex system and I am still not sure if I am lending a hand.
Hi, thanks for your feedback. You are right, the previous code got the index of the iterator. It should be getKey()
rather than getKeyIdx()
.
I just fixed the bug, please update your code and check my modification.
Good job!