Programming Collective Intelligence 推荐系统 读书笔记二

  这章主要讲了如何做推荐,现在推荐最常用的几种算法:Collaborative Filtering、Cluster Models、Search-Based Methods、Item-to-Item Collaborative Filtering.前两种是通过找相似的Customer,后两种通过找相似的Item.论文Amazon.com Recommendations Item-to-Item Collaborative Filtering 对这几种算法都有介绍。这章主要提了Collaborative Filtering和tem-to-Item Collaborative Filtering。 Collaborative Filtering:通过搜索大量的Customer数据集来找到那一小撮和你口味相似的。书中举了一个电影评论的例子,每个人都对一些电影进行评等级,通过这些数据来找到和你口味相似的人,以及对你没有看过的电影做推荐,并以这个例子演示了如何做推荐。

准备数据:(本笔记的代码使用ruby实现,python代码的实现见原书)

Ruby代码  复制代码
  1. critics={  
  2.     'Lisa Rose' => { 'Lady in the Water' => 2.5, 'Snakes on a Plane' => 3.5,  
  3.     'Just My Luck' => 3.0, 'Superman Returns' => 3.5, 'You, Me and Dupree' => 2.5,  
  4.     'The Night Listener' => 3.0},  
  5.   
  6.     'Gene Seymour' => { 'Lady in the Water' => 3.0, 'Snakes on a Plane' => 3.5,  
  7.     'Just My Luck' => 1.5, 'Superman Returns' => 5.0, 'The Night Listener'=> 3.0,  
  8.     'You, Me and Dupree' => 3.5},  
  9.   
  10.     'Michael Phillips' => { 'Lady in the Water' => 2.5, 'Snakes on a Plane' => 3.0,  
  11.     'Superman Returns' => 3.5, 'The Night Listener' => 4.0},  
  12.   
  13.     'Claudia Puig' => { 'Snakes on a Plane' => 3.5, 'Just My Luck' => 3.0,  
  14.     'The Night Listener' => 4.5, 'Superman Returns' => 4.0,  
  15.     'You, Me and Dupree' => 2.5},  
  16.   
  17.     'Mick LaSalle'=> { 'Lady in the Water' => 3.0, 'Snakes on a Plane' => 4.0,  
  18.     'Just My Luck' => 2.0, 'Superman Returns' => 3.0, 'The Night Listener' => 3.0,  
  19.     'You, Me and Dupree' => 2.0},  
  20.   
  21.     'Jack Matthews'=> { 'Lady in the Water' => 3.0, 'Snakes on a Plane' => 4.0,  
  22.     'The Night Listener'=> 3.0, 'Superman Returns'=> 5.0, 'You, Me and Dupree' => 3.5},  
  23.   
  24.     'Toby' => { 'Snakes on a Plane' =>4.5,'You, Me and Dupree' =>1.0,'Superman Returns' => 4.0}  
  25. }  

 

定义相似度:

欧拉距离:

 

 

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值