Thursday 18 February 2016

Lenskit: Popular items evaluation exception solution

In Lenskit 2.2.1 in evaluation when algorithms get to rank popular items the framework throws exception. The problem has been reported to the authors of Lenskit and it will be fixed soon. In this post I offer a workaround for this problem for those who use version 2.2.1.

When I do this:

evaluator.addMetric(new PrecisionRecallTopNMetric("", "", 5, ItemSelectors.mostPopular(5), ItemSelectors.trainingItems(), ItemSelectors.testRatingMatches(Matchers.greaterThanOrEqualTo(THRESHOLD))));

I get this exception:
Here is how the problem can be fixed. However, popular items are going to be chosen based on the whole dataset regardless of the training/test part. First, we need an ItemSelector class.
Finally, we need popular items:
I would like to thank Lenskit developers for quick replies. In my opinion, the framework is developed professionally. Hope this post is helpful.

No comments:

Post a Comment