`

Item-based recommendation

 
阅读更多

User-based: Who is similar to the boy, and what do they like?

Item-based:  What is similar to what the boy likes?

 

The algorithm



 The difference between User-based and Item-based :


Slope-one recommender 

 It estimates preferences for new items based on average difference in the preference value (diffs) between a new item and the other items the user prefers.

Formula




 

 

In this case, the average difference in ratings between item B and A is (2+(-1))/2=0.5. Hence, on average, item A is rated above item B by 0.5. Similarly, the average difference between item C and A is 3. Hence, if we attempt to predict the rating of Lucy for item A using her rating for item B, we get 2+0.5 = 2.5. Similarly, if we try to predict her rating for item A using her rating of item C, we get 5+3=8.

If a user rated several items, the predictions are simply combined using a weighted average where a good choice for the weight is the number of users having rated both items. In the above example, we would predict the following rating for Lucy on item A:



Hence, given n items, to implement Slope One, all that is needed is to compute and store the average differences and the number of common ratings for each of the n2 pairs of items.

 

 

preprocessing phase, in which all item-item preference value differences are computed:

 

recommendation algorithm looks like this:



 

SampleCode

DiffStorage diffStorage = new MemoryDiffStorage(model, Weighting.UNWEIGHTED, Long.MAX_VALUE));
return new SlopeOneRecommender(model,Weighting.UNWEIGHTED,Weighting.UNWEIGHTED,
diffStorage); 
//or 
return new SlopeOneRecommender(model)

 Slope-one does have its price: memory consumption.It may become necessary to store diffs elsewhere.

AbstractJDBCDataModel model = new MySQLJDBCDataModel();
DiffStorage diffStorage = new MySQLJDBCDiffStorage(model);
Recommender recommender = new SlopeOneRecommender(model, Weighting.WEIGHTED, Weighting.WEIGHTED, diffStorage);

 

 

 

References

http://en.wikipedia.org/wiki/Slope_One

  • 大小: 19.9 KB
  • 大小: 47.9 KB
  • 大小: 12.4 KB
  • 大小: 20.8 KB
  • 大小: 20.8 KB
  • 大小: 578 Bytes
  • 大小: 1.9 KB
  • 大小: 9.2 KB
  • 大小: 1.1 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics