美文网首页
提供推荐

提供推荐

作者: 九尾喵的薛定谔 | 来源:发表于2017-08-10 22:09 被阅读0次

http://www.oreilly.com/catalog/9780596529321

# A dictionary of movie critics and their ratings of a small
# set of movies
critics={'Lisa Rose': {'Lady in the Water': 2.5, 'Snakes on a Plane': 3.5,
 'Just My Luck': 3.0, 'Superman Returns': 3.5, 'You, Me and Dupree': 2.5, 
 'The Night Listener': 3.0},
'Gene Seymour': {'Lady in the Water': 3.0, 'Snakes on a Plane': 3.5, 
 'Just My Luck': 1.5, 'Superman Returns': 5.0, 'The Night Listener': 3.0, 
 'You, Me and Dupree': 3.5}, 
'Michael Phillips': {'Lady in the Water': 2.5, 'Snakes on a Plane': 3.0,
 'Superman Returns': 3.5, 'The Night Listener': 4.0},
'Claudia Puig': {'Snakes on a Plane': 3.5, 'Just My Luck': 3.0,
 'The Night Listener': 4.5, 'Superman Returns': 4.0, 
 'You, Me and Dupree': 2.5},
'Mick LaSalle': {'Lady in the Water': 3.0, 'Snakes on a Plane': 4.0, 
 'Just My Luck': 2.0, 'Superman Returns': 3.0, 'The Night Listener': 3.0,
 'You, Me and Dupree': 2.0}, 
'Jack Matthews': {'Lady in the Water': 3.0, 'Snakes on a Plane': 4.0,
 'The Night Listener': 3.0, 'Superman Returns': 5.0, 'You, Me and Dupree': 3.5},
'Toby': {'Snakes on a Plane':4.5,'You, Me and Dupree':1.0,'Superman Returns':4.0}}
>>> from recommendations import critics
>>> critics['Lisa Rose']['Lady in the Water']
2.5
>>> critics['Toby']['Snakes on a Plane']=4
>>> critics['Toby']
{'Snakes on a Plane': 4, 'Superman Returns': 4.0, 'You, Me and Dupree': 1.0}
>>> critics['Toby']['Snakes on a Plane']=4.5

相似度评价体系

  • 欧几里得距离
  • 皮尔逊相关系数

欧几里得距离

>>> from recommendations import sim_distance,critics
>>> sim_distance(critics,'Lisa Rose','Gene Seymour')
0.14814814814814814

皮尔逊相关系数

>>>from recommendations import critics, sim_pearson
>>>sim_pearson(critics,'Lisa Rose','Gene Seymour') 
0.39605901719066977
>>> from recommendations import critics, sim_pearson,topMatches
>>> topMatches(critics,'Toby',n=3)
[(0.9912407071619299, 'Lisa Rose'), (0.9244734516419049, 'Mick LaSalle'), (0.8934051474415647, 'Claudia Puig')]

相关文章

  • 提供推荐

    http://www.oreilly.com/catalog/9780596529321 相似度评价体系 欧几里得...

  • 集体智慧编程:提供推荐_推荐物品

    前面已经实现不同人之间相似度的计算,接下来就是根据相似度,向用户推荐物品。找到相似度最高的用户B,将他的喜好推荐给...

  • 根据群体偏好提供推荐

    python中有保存数据集有两种类型比较常用 1.列表:由一组任意类型的值构成的有序列表,写法上使用方括号 ' [...

  • [R - ml]推荐系统

    推荐系统 recommenderLab 针对realRatingMatrix, recommenderLab 提供...

  • unit2 电影推荐

    推荐算法在当下使用场景较多,亚马逊书籍推荐,商品推荐等等。《集体智慧编程》第二单元“提供推荐”构造简单的推荐系统,...

  • ​让客户帮你说句话

    ​要提供顾客推荐,最好是名人推荐。 第一,就是使用顾客推荐,最好是名人推荐; 第二,就是使用顾客推荐,最好是名人推...

  • 推荐系统评测方法和评测指标

    一般推荐系统的参与方有3个:用户、物品提供商、推荐系统提供网站,评测一个推荐系统时,需要考虑3方的利益,一个好的推...

  • 爱享到产品矩阵体验

    纵观产品的核心,to c 方面是为用户提供美食推荐和享受折扣,让用户不仅仅在美食并在生活本地上提供信息推荐。 产品...

  • 提供推荐(集体智慧) —— 使用MovieLens数据为用户推荐

    0x00 下载MovieLens数据 1) 从网站http://grouplens.org/datasets/mo...

  • 第一章 - 提供推荐

    欢迎来到AI入门 - 集体智慧编程的第一章,这一章节里Pan会带着你制作一个简单的推荐系统。 学习成果 基于电影影...

网友评论

      本文标题:提供推荐

      本文链接:https://www.haomeiwen.com/subject/wykkrxtx.html