0
我想使用示例數據「intro.csv」使用下面的代碼運行KnnItemBasedRecommender,但是我得到空集作爲結果。Mahout建議返回空集
public static void main(String[] args) throws Exception {
DataModel model = NeuvidisData.convertToDataModel();
//RecommenderEvaluator evaluator = new AverageAbsoluteDifferenceRecommenderEvaluator();
RecommenderBuilder recommenderBuilder = new RecommenderBuilder() {
@Override
public Recommender buildRecommender(DataModel model) {
ItemSimilarity similarity = new LogLikelihoodSimilarity(model);
Optimizer optimizer = new ConjugateGradientOptimizer();
return new KnnItemBasedRecommender(model, similarity, optimizer, 2);
}
};
Recommender rec = recommenderBuilder.buildRecommender(model);
List<RecommendedItem> rcList = rec.recommend(1, 2);
for(RecommendedItem item:rcList)
{
System.out.println("item:");
System.out.println(item);
}
}
有人能幫助我嗎?
謝謝你的迴應。我已經上傳數據文件,這裏是鏈接(https://docs.google.com/file/d/0B-TfUyCFoQ_3X0kwN3ZQeDlMdTA/edit?usp=sharing) – Swamy
我用KnnItemBasedRecommender用不同的數據集嘗試過,我發現結果取決於DataModel的構建方式。當我使用LogLikelihoodSimilarity而PearsonCorrelationSimilarity工作正常時,沒有結果。請通過一些燈光。 – Swamy
希望你能夠訪問上傳的數據。如果您需要更多輸入,請告訴我。先謝謝你。 – Swamy