mahout in action 协同过滤

public class myMahout {
	public static void main(String args[]) throws Exception {
		DataModel model = new FileDataModel(new File("C:/total.csv")); // 选择数据文件MovieLen
		RecommenderEvaluator evaluator = new AverageAbsoluteDifferenceRecommenderEvaluator();
		RecommenderBuilder builder = new RecommenderBuilder() {
			@Override
			public Recommender buildRecommender(DataModel model)
					throws TasteException {
				UserSimilarity similarity = new PearsonCorrelationSimilarity(
						model); // 选择相似度计算方法
				UserNeighborhood neighborhood = new NearestNUserNeighborhood(
						10, similarity, model); // 10 表示邻居数目
				return new GenericUserBasedRecommender(model, neighborhood,
						similarity);
			}
		};
		double score = evaluator.evaluate(builder, null, model, 0.8, 1.0); // 80%的训练集合,100%的原始数据
		System.out.println(score);//MAE

	}
}
刚收到 mahout in action,45刀, mahout 做协同过滤推荐时间效率非常高,但是精度却比较差,只能依靠自己重写推荐算法吗?

你可能感兴趣的:(Mahout,协同过滤)