0

我有一个用户估计表。大约有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();
    }
4

1 回答 1

7

那只是意味着没有任何东西有资格获得推荐。您的数据集很小,而且我想太稀疏了。Pearson 不能很好地处理稀疏数据,因为它很少能计算任何相似性。

于 2012-07-13T15:33:25.137 回答