我正在使用 mahout 为可能的应用程序创建一个基本推荐器。我的数据集没有任何偏好。这是我的桌子的样子
这是设置 mahout 的方法
MySQLJDBCDataModel jdbcModel2 = new MySQLJDBCDataModel(dataSource,"user_viewed_song_statistics",
"AUDIO_FK","USER_PROFILE_FK","AUDIO_FK","UVSS_DATE_CREATED");
ItemSimilarity similarity = new LogLikelihoodSimilarity(jdbcModel2);
Recommender recommender =
new GenericBooleanPrefItemBasedRecommender(jdbcModel2, similarity);
for(RecommendedItem item: recommender.recommend(1, 1))
System.out.println(item);
然而,在运行这个之后。它返回了这个错误
Exception in thread "main" java.lang.IllegalArgumentException
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:72)
at org.apache.mahout.math.stats.LogLikelihood.logLikelihoodRatio(LogLikelihood.java:101)
at org.apache.mahout.cf.taste.impl.similarity.LogLikelihoodSimilarity.doItemSimilarity(LogLikelihoodSimilarity.java:102)
at org.apache.mahout.cf.taste.impl.similarity.LogLikelihoodSimilarity.itemSimilarities(LogLikelihoodSimilarity.java:90)
at org.apache.mahout.cf.taste.impl.recommender.GenericBooleanPrefItemBasedRecommender.doEstimatePreference(GenericBooleanPrefItemBasedRecommender.java:54)
at org.apache.mahout.cf.taste.impl.recommender.GenericItemBasedRecommender$Estimator.estimate(GenericItemBasedRecommender.java:312)
at org.apache.mahout.cf.taste.impl.recommender.GenericItemBasedRecommender$Estimator.estimate(GenericItemBasedRecommender.java:300)
at org.apache.mahout.cf.taste.impl.recommender.TopItems.getTopItems(TopItems.java:65)
at org.apache.mahout.cf.taste.impl.recommender.GenericItemBasedRecommender.recommend(GenericItemBasedRecommender.java:131)
at org.apache.mahout.cf.taste.impl.recommender.AbstractRecommender.recommend(AbstractRecommender.java:63)
at Starter.main(Starter.java:53)