Evaluating an External Recommender written in Python using LensKit
By Vikas Kumar on
In this article, we show how to use LensKit to evaluate a recommender written in Python. We wrote this article to help people who want to use LensKit’s built-in evaluation capabilities and comparison algorithms, but don’t want to implement their own algorithms in Java. Evaluating an external recommender — whether in R, Python, or MatLab, involves three primary steps:
- Writing the recommender. We will need a simple recommender written in language other than Java (Python in this case) that can take test data to build up a simple model and generate recommendations for a given list of test users.
- Setting up a shim class. We will need to write a small class that teaches LensKit how to use our external algorithm.
- Setting up LensKit evaluation. Finally we show how we setup an experiment using the shim class in a LensKit eval script to evaluate the external recommender.
Note, that the data we will use to test this recommender is a MovieLens rating dataset. The data consists of movie ratings with each row being <userId,itemId,rating>. You can read more about the dataset here. (more…)