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