java - Google preconditions illegal Argument exception -
i using mahout create basic recommender may application. data set not have preferences. here's how table looks like
here's how set 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);
however after running this. returned error
exception in thread "main" java.lang.illegalargumentexception @ com.google.common.base.preconditions.checkargument(preconditions.java:72) @ org.apache.mahout.math.stats.loglikelihood.loglikelihoodratio(loglikelihood.java:101) @ org.apache.mahout.cf.taste.impl.similarity.loglikelihoodsimilarity.doitemsimilarity(loglikelihoodsimilarity.java:102) @ org.apache.mahout.cf.taste.impl.similarity.loglikelihoodsimilarity.itemsimilarities(loglikelihoodsimilarity.java:90) @ org.apache.mahout.cf.taste.impl.recommender.genericbooleanprefitembasedrecommender.doestimatepreference(genericbooleanprefitembasedrecommender.java:54) @ org.apache.mahout.cf.taste.impl.recommender.genericitembasedrecommender$estimator.estimate(genericitembasedrecommender.java:312) @ org.apache.mahout.cf.taste.impl.recommender.genericitembasedrecommender$estimator.estimate(genericitembasedrecommender.java:300) @ org.apache.mahout.cf.taste.impl.recommender.topitems.gettopitems(topitems.java:65) @ org.apache.mahout.cf.taste.impl.recommender.genericitembasedrecommender.recommend(genericitembasedrecommender.java:131) @ org.apache.mahout.cf.taste.impl.recommender.abstractrecommender.recommend(abstractrecommender.java:63) @ starter.main(starter.java:53)
you using non-preference item recommendation. similar question
and find weird returning type of exception. i've done this.
mysqlbooleanprefjdbcdatamodel jdbc = new mysqlbooleanprefjdbcdatamodel(datasource, table_name, user_id, item_id); cachingrecommender cachingrecommender = new cachingrecommender( new slopeonerecommender(jdbc)); // 5 recommendations user 3 list<recommendeditem> items = cachingrecommender.recommend(3, 5); (recommendeditem item : items) { system.out.println(item); }
hope helps.
Comments
Post a Comment