I'm writing a recommender system evaluator with Apache Mahout, using a train.csv training set and the Precision metric. My question is: it's possible to use a fixed test set, not generated by the evaluator?
To be more specific, I have a test.csv file that contains a list of UserIds and for these I want to provide recommendations and evaluate the results with the Precision metric, only for this fixed set of users that never changes. Their ratings are in the file train.csv, I use it to train the algorithm and it contains also all the other user's ratings.
I post also the code where I want to add this feature:
RandomUtils.useTestSeed();
DataModel model = new FileDataModel(new File("files/train.csv"));
RecommenderIRStatsEvaluator evaluator = new GenericRecommenderIRStatsEvaluator();
RecommenderBuilder recommenderBuilder = new RecommenderBuilder() {
public Recommender buildRecommender(DataModel model) throws TasteException {
//Here I build my recommender system
//return ...
}
};
IRStatistics stats = evaluator.evaluate(recommenderBuilder, null, model, null, 5,
4/*relevance Threshold*/, 1);
System.out.println(stats.getPrecision());