简体   繁体   中英

recommender system using apache mahout error

i want to buil a recommender system using apache mahout I created java class but i have a error can some one help me please
the error

run: [INFO ] 2017-03-24 22:11:15,995 -- Creating FileDataModel for file C:\\ml-latest-small\\dat.csv Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.io.Closeables.closeQuietly(Ljava/io/Closeable;)V at org.apache.mahout.cf.taste.impl.model.file.FileDataModel.(FileDataModel.java:178) at org.apache.mahout.cf.taste.impl.model.file.FileDataModel.(FileDataModel.java:148) at javaapplication15.JavaApplication15.main(JavaApplication15.java:45) Java Result: 1

  public static void main(String[] args) throws IOException, TasteException  {
  DataModel model = new FileDataModel(new File("C:/ml-latest-small/dat.csv"));
  UserSimilarity similarity = new TanimotoCoefficientSimilarity(model);
  UserNeighborhood neighborhood = new ThresholdUserNeighborhood(0.1, similarity, model);
  UserBasedRecommender recommender = new GenericUserBasedRecommender(model, neighborhood, similarity);

  List<RecommendedItem> recommendations = recommender.recommend(2, 3);

for (RecommendedItem recommendation : recommendations) { System.out.println(recommendation);

I should mention that the old Mahout recommenders are being deprecated. The new batch are based on the Spark compute engine rather than the somewhat outdated Hadoop Mapreduce.

The Mahout Model building is here: http://mahout.apache.org/users/algorithms/intro-cooccurrence-spark.html

And a fully functional system called the Universal Recommender is built on Apache PredictionIO is here: http://actionml.com/docs/ur

There are also ALS, matrix factorization based algos in Mahout and Spark MLlib. These and in raw form and need a systems built around them to manage data and serve recs. The Universal Recommender mentioned above is the only one to come relatively turnkey.

Any of these would be a better starting point than code being deprecated.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM