承接上一篇Recommender Systems Handbook读书笔记之第四章(2),记录一下本章的最后一部分。
基于近邻的推荐方法,有三个重要技术点需要关注:1)评价的归一化;2)相似度权值计算方法;3)近邻的选择。
1、评价归一化
当用户对item进行评价打分时,每个人心目中的标准是不一样的,比如user A对与一般喜欢的item通常打6分,而user B对与一般喜欢的分值则在8分(0~10分的区间)。因此直接将该评价分值用于计算是不公平的,需要对评价进行归一化。常用的归一化方法有mean-centering和Z-score的方法。
Mean-centering:mean-centering也即是一种去平均值的方法,实际评价分值减去用户的评级的平均分值作为归一化之后的评价得分:
因此,user-based CF的评分预测函数为:
Item-based CF的评分预测函数为:
Z-score:考虑两个用户,user A对item的评价都是3分,而user B对item评分分布从1~5都有,且他们的均值都是3分。显然,我们在做预测评分时,user B的用户数据更有用,也即是说在评分上跨度更大,则更能反映出用户的兴趣爱好,也就更易于预测。因此在mean-centering的基础上,Z-score考虑了用户评分跨度(spread):
Z-score更常用语user-based CF方法中。
注意归一化方法并不一定会给效果带来正面收益,例如如果一个用户只对自己喜欢的电影进行评价,对不喜欢的电影不予评价,则归一化将会带来负面作用。再如,如果一个用户只对很少的个item有评价,则归一化也会带来较大的负面作用。一般来说,在数据不是很稀疏的情况下,对评分做归一化还是能带来一定的收益。
2、相似度权值计算
常见的相似度计算方法有cos similarity和Pearson Correlation (PC) similarity。
Cos similarity的计算方法为:
Iuv表示至少被u和v都点击过一次的item。Cos相似度的计算方法有一个缺点:没有考虑不同用户之间评分标准的不同。
Pearson Correlation (PC) similarity的计算方法
两个用户之间的相似度:
两个item之间的相似度:
计算结果前的符号表示是正相关还是负相关。
不同用户对相似度值的计算贡献应该是不一样,如果A用户与B用户有100个共同点击的item,用户A与用户C之间的直接有3个共同点击的item,则在用B与C来预测A对某个item的评价是,B与A之间的相似度应该比C与A之间的相似度应该具有更强的说服力。换句话说,不同用户之间的相似度对于评分阈值应该是不同的,具有各自的权重。相似度权重计算的大体思路是:如果相似度是在少数样本下计算得到的,则将其添加一个惩罚因子,降低该相似度的权重,常用的方法为:
另外,如果用户经常以同样的方式对item进行评价,则相对有变化的评价来说,所含有的信息量将会少很多。因此为了利用这种更有价值的变化的评价,可以对评价打分进行了一种类似idf的加权方式。
3、近邻选择
在推荐系统中近邻的选择通常有两个步骤:1)进行全局的筛选,保留有可能是近邻的候选;2)选出对推荐最有帮助的近邻。全局筛选有Top-N,阈值过滤等方法。在选近邻阶段,
关于近邻个数的选择,太多也不是太好,有可能会因为很多噪音点将一些强相关的点稀释掉了,文中推荐好的近邻最好选择在20到50之间,实际中可以用交叉验证来进行选择合适的个数。书中,这一部分讲解比较浅。