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
本文介绍了Slope One推荐算法的工作原理及其应用。该算法通过计算物品间的评分差值来预测用户对未评分物品的喜好程度。适用于场景中物品属性明确、用户评分数据丰富的环境。
1788

被折叠的 条评论
为什么被折叠?



