0

I am facing a small problem while running Recommender engine in Mahout:

The data set on which I am working is given below:

1,101,5.0
1,102,4.0
1,103,4.0
1,107,5.0
1,108,3.0
2,101,3.0
2,102,4.0
2,104,4.0
2,105,4.0
3,101,5.0
3,102,4.0

When I calculate the Pearson similarity between 1 and 3 I get a value 0.99999998 approx 1.0 Which is best similarity, So according to recommendation rule. The output for recommendation to User_ID 3 should be Item_ID 107

But my output gives no recommendation.

Below is my code:

public static void main( String[] args ) throws Exception
{
    ///////////////////////Data Model//////////////////////////////////////
    DataModel model = new FileDataModel(new File("data/dataset_2.csv"));
    System.out.println(model.getMaxPreference());

    ///////////////////Similarity between Users////////////////////////////
    UserSimilarity similarity = new PearsonCorrelationSimilarity(model);

    System.out.println("Pearson distance "+similarity.userSimilarity(3, 1));

    //////////////////The Neighbors who satisfy the threshold level//////////

    UserNeighborhood neighborhood = new ThresholdUserNeighborhood(0.1, similarity, model);

    ///////////////////Recommender recomending the best/////////////////////////
    UserBasedRecommender recommender = new GenericUserBasedRecommender(model, neighborhood, similarity);

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

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

}

I would appreciate If anybody could point out the mistake if any or If my understanding on Mahout pearson corellation is wrong.

Sam
  • 2,545
  • 8
  • 38
  • 59

1 Answers1

0

PearsonCorrelationSimilarity does not work well with small and less similar dataset. You can change similarity method or neighbourhood size. When you increase dataset size, you will get good result. In addition, you can increase recommendation size (for recommend function howMany).

mnemosyne
  • 1
  • 1