1

I am using Apache Mahout Library for Recommendation but I fail to understand its working as it works for some of my cases and doesn't work for others. I a using Apache Mahout 0.12.2 version in Java 8.

Code

public class SampleRecommender {

public static void main(String[] ars) throws IOException, TasteException
{
    DataModel dataModel = new FileDataModel(new File("E:\\Rakshit\\Recommender\\stackdata.csv"));
    UserSimilarity similarity = new PearsonCorrelationSimilarity(dataModel);
    UserNeighborhood neighborhood = new ThresholdUserNeighborhood(0.1, similarity, dataModel);
    UserBasedRecommender recommender = new GenericUserBasedRecommender(dataModel, neighborhood, similarity);

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

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

}

For Example for the following data it does not work

3,101,5.0
3,102,5.0
3,104,5.0
4,102,2.0
4,104,4.0
4,105,2.5
4,107,3.0
5,101,5.0
5,102,5.0
5,104,5.0
5,105,4.0

While for this data it works

3,101,5.0
3,102,2.0
3,105,2.5
4,102,2.0
4,104,4.0
4,105,2.5
4,107,3.0
5,101,5.0
5,102,3.4
5,104,2.5
5,105,2.5

Output

RecommendedItem[item:104, value:3.3029697]

The difference in the two data is in the rating values of userID 3 and userID 5

Any help would be appreciated

Xavier
  • 113
  • 1
  • 8
  • I'm happy to help, but this is a very poorly formed question. I'm not going to downvote yet, but we need a lot of information about what you've done, code, CLI driver? Mahout Version? Spark Version? etc. – rawkintrevo Apr 18 '17 at 14:37

1 Answers1

0

The Mahout code you are using will be deprecated soon. However Mahout has a newer better version. Answers are on a similar question here:

Apache Mahout not giving any recommendation

Community
  • 1
  • 1
pferrel
  • 5,673
  • 5
  • 30
  • 41