《Programming Collective Intelligence》笔记之 Chapter 2
2017-01-12 14:47
351 查看
对欧几里德距离(Euclidean Distance)的理解
假设主体为 a, 对主体的评价为 a1, a2, a3假设主体为 b, 对主体的评价为 b1, b2, b3
设某坐标系有 x1, x2, x3 三条坐标轴,则 a, b 在此坐标系中的坐标可以表示为 (a1, a2, a3) 和 (b1, b2, b3)
而 a 与 b 的距离即可作为它们的相似程度,距离越近越相似。
通常情况下,a与b的相似度取距离的倒数:
Similarity(a,b) = 1/Distance(a, b)
优点
方便理解,日后凡是要求2种物品的相似度,都可以先在脑海中想像一个坐标系上的2个点,然后再去思考它们的维度应该是什么。对于电影来说,维度为评分,对于链接来说,维度是访问量。缺点
可参考维度越多,相似度越小。假设平面上2个点 a(0,0), b(1,1) 此时它们的相似度是 1/(1+2) = 1/3
假设增加一个维度后,变成 a(0,0,0), b(1,1,1),则此时它们的相似度是 1/(1+3) = 1/4
显然,维度增加后,它们的相似度变小了。除非新增的维度值相差为0.
对皮尔森相关系数(Pearson Correlation Coefficient)的理解
同样计算 a, b 两个产品的相似度,分别以 a, b 的评价为 x, y 坐标轴,则可得到3个点 (a1, b1), (a2, b2), (a3, b3) 通过计算这3个点在坐标系中的相关系数,可得到相似度。优点
相对于 Euclidean Distance 来说,数据越多越准确所谓 User-based Filtering 和 Item-Based Filtering
设产品数量为 m, 用户数量为 n, 现需要为用户推荐他感兴趣,但还没购买的产品。User-based Filtering 的做法
算出其他用户与当前用户的相似度遍历用户
遍历产品
以其他用户为媒介,算出对未购买产品的兴趣度
遍历用户
遍历未购买产品
Item-based Filtering 的做法
算出所有产品的相似度遍历产品
遍历产品
以已购买产品为媒介,算出未购买产品的兴趣度
遍历已购买产品
遍历未购买产品
总结
两者都需要3个要素,(用户,用户,产品),或(用户,产品,产品)一个利用用户与用户之间的相似度,计算出产品的兴趣度
另一个利用产品与产品之间的相似度,计算出产品的兴趣度
User-based 仅适用于紧致型(dense)数据,计算量大,不可分步骤计算
Item-based 可适用于稀疏型(sparse)数据,计算量小,并可分步骤计算
相关文章推荐
- Programming Collective Intelligence笔记 - Discovering Groups
- Programming Collective Intelligence笔记 - 最优化
- Programming Collective Intelligence笔记 - Document Filtering
- 读《Programming Collective Intelligence》chapter 2
- Programming Collective Intelligence笔记 - Ranking
- Programming Collective Intelligence笔记 - Making Recommendations
- programming collective intelligence --chapter03 笔记
- An Algorithm Summary of Programming Collective Intelligence
- 《programming.collective.intelligence》(集体智慧编程)读书笔记
- 'Programming Collective Intelligence'读书笔记
- Programming With Microsoft Visual Studio C++.NET 6th Edition 读书 4000 笔记(1) Chapter 5: Windows Message Mapping
- Beginning Linux Programming 4th Edition 学习笔记 - Chapter 1:Getting started
- Programming Collective Intelligence: Building Smart Web 2.0 Applications
- Understanding Unix/Linux Programming 笔记:chapter 8:进程和程序:编写命令解释器sh
- Programming Collective Intelligence 推荐系统 读书笔记二
- 《Programming Collective Intelligence》review
- 集体智慧编程 Programming Collective Intelligence 书中代码程序研究
- programming collective intelligence是本好书
- An Algorithm Summary of Programming Collective Intelligence (2)
- An Algorithm Summary of Programming Collective Intelligence (4)