Mahout推荐器返回空结果

时间:2012-07-13 12:16:23

标签: java mahout

我有一张估算用户的表格。大约有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();
    }

1 个答案:

答案 0 :(得分:7)

这意味着没有资格获得推荐。你的数据集很小,我想象的太稀疏了。 Pearson不能很好地处理稀疏数据,因为它很少计算任何相似性。