java - No recommendation in a simple Mahout item-based recommender -
i'm testing simple mahout item-based recommender 4 items , 1 user:
model following:
1,00,5.0 1,01,5.0
so, user 1 "appreciated" item 0 , 1.
the java code following:
datamodel model = new filedatamodel(new file("datatest2.txt")); collection<itemitemsimilarity> similarities = new arraylist<>(); similarities.add(new itemitemsimilarity(0, 1, +1.0)); similarities.add(new itemitemsimilarity(0, 2, +1.0)); similarities.add(new itemitemsimilarity(0, 3, -1.0)); similarities.add(new itemitemsimilarity(1, 2, +1.0)); similarities.add(new itemitemsimilarity(1, 3, -1.0)); similarities.add(new itemitemsimilarity(2, 3, -1.0)); genericitemsimilarity sim = new genericitemsimilarity(similarities); recommender recommender = new genericitembasedrecommender(model, sim); list<recommendeditem> recommendations = recommender.recommend(1,1); system.out.println("list "+recommendations.size()); (recommendeditem recommendation : recommendations) { system.out.println(" recommendation: " + recommendation); }
so, have list of pre-computed correlations says: item 0, 1 , 2 similar , item 3 different compared 0, 1, , 2. then, think when ask recommendation user 1 (he "appreciated" item 0 , 1 + item 0, 1 , 2 similar) "item 2" recommendation, instead 0 recommendation. output:
16/11/08 12:08:56 info file.filedatamodel: creating filedatamodel file datatest2.txt 16/11/08 12:08:56 info file.filedatamodel: reading file info... 16/11/08 12:08:56 info file.filedatamodel: read lines: 2 16/11/08 12:08:56 info model.genericdatamodel: processed 1 users list 0
what's wrong this?
Comments
Post a Comment