Recommender evaluation with Mahout
Mahout provides a set of classes to help with the task of evaluating our recommender. Like the cross-validation we performed with the clj-ml
library in Chapter 4, Classification, Mahout's evaluation proceeds by splitting the our ratings into two sets: a test set and a training set.
By training our recommender on the training set and then evaluating its performance on the test set, we can gain an understanding of how well, or poorly, our algorithm is performing against real data. To handle the task of training a model on the training data provided by Mahout's evaluator, we must supply an object conforming to the RecommenderBuilder
interface. The interface defines just one method: buildRecommender
. We can create an anonymous RecommenderBuilder
type using reify:
(defn recommender-builder [sim n] (reify RecommenderBuilder (buildRecommender [this model] (let [nhood (NearestNUserNeighborhood. n sim model)] (GenericUserBasedRecommender...