我有一个用户估计表。大约有1000个条目。从这些数据中,我想建立一个推荐,但返回一个空列表 Mahout。可能是什么问题?
JDBCDataModel dataModel = new MySQLJDBCDataModel(source, "rate", "userId", "eventId", "rate", null);
dataModel.refresh(null);
try {
UserSimilarity userSimilarity = new PearsonCorrelationSimilarity(dataModel);
userSimilarity.setPreferenceInferrer(new AveragingPreferenceInferrer(dataModel));
UserNeighborhood neighborhood =
new NearestNUserNeighborhood(10, userSimilarity, dataModel);
Recommender recommender =
new GenericUserBasedRecommender(dataModel, neighborhood, userSimilarity);
Recommender cachingRecommender = new CachingRecommender(recommender);
List<RecommendedItem> recommendations =
cachingRecommender.recommend(user.id, 10);
} catch (TasteException e) {
e.printStackTrace();
}