在http://blog.csdn.net/jianjian1992/article/details/47304337里边有关于推荐系统的完整代码,其中有一个评价器RecommenderEvaluator用来评价推荐器的好坏。
RecommenderEvaluator evalutor = new AverageAbsoluteDifferenceRecommenderEvaluator();
System.out.println("eval:"+ evalutor.evaluate(recommenderBuilder, null, model, 0.5, 1));
在源码中对它定义的evaluate函数介绍如下:
* Evaluates the quality of a {@link org.apache.mahout.cf.taste.recommender.Recommender}'s recommendations.
* The range of values that may be returned depends on the implementation, but <em>lower</em> values must
* mean better recommendations, with 0 being the lowest / best possible evaluation, meaning a perfect match.
* This method does not accept a {@link org.apache.mahout.cf.taste.recommender.Recommender} directly, but
* rather a {@link RecommenderBuilder} which can build the
* {@link org.apache.mahout.cf.taste.recommender.Recommender} to test on top of a given {@link DataModel}.
它是用来评价一个推荐器的质量的;
它返回的值越小则代表推荐器推荐效果越好;
评价方法并不直接接受一个推荐器作为参数,而是接受一个可以创建推荐器的推荐器创建方法来在给定的数据模型上进行测试;
* Implementations will take a certain percentage of the preferences supplied by the given {@link DataModel}
* as "training data". This is typically most of the data, like 90%. This data is used to produce
* recommendations, and the rest of the data is compared against estimated preference values to see how much
* the {@link org.apache