Item-based recommendation

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

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值