Slope One最大优点在于算法很简单, 易于实现, 执行效率高, 同时推荐的准确性相对很高。Slope One来自Daniel Lemire和Anna Machlachlan的论文Slope One Predictors for Online Rating-Based Collaborative Filtering,有需要可以下载看一下。

Slope One
其基本的想法来自于简单的一元线性模型 w=f(v)=v+b。已知一组训练点 (vi,wi)ni=1,利用此线性模型最小化预测误差的平方和:

利用上式获得了b的取值后,对于新的数据点vnew,我们可以利用 wnew=b+vnew 获得它的预测值。直观上我们可以把上面求偏移 b 的公式理解为 wi 和 vi 差值的平均值。

上图所示,定义item i 相对于 item j 的平均偏差:

其中 Sj,i() 表示同时对item i 和 j 给予了评分的用户集合,而 card() 表示集合包含的元素数量。有了上面的定义后,我们可以使用

获得用户 u 对 item j 的预测值。当把所有这种可能的预测平均起来,可以得到:

其中 Rj 表示所有用户 u 已经给予评分且满足条件 (i≠j 且 Sj,i非空) 的item集合。对于足够稠密的数据集,我们可以使用近似

把上面的预测公式简化为

Weighted Slope One
Slope One中在计算 item i 相对于 item j 的平均偏差 devj,i 时没有考虑到使用不同的用户数量平均得到的devj,i,其可信度不同。假设有 2000 个用户同时评分了 item j 和 k,而只有20 个用户同时评分了 item j和 l,那么显然获得的 devj,k 比 devj,l 更具有说服力。所以一个修正是对最终的平均使用加权:


【转载】推荐算法-slope one
网友评论