- 分别使用基于用户的协作型过滤算法和基于物品的协作型过滤算法来达到推荐商品的目的
- 用欧几里得距离或皮尔逊相关系数来计算相似度。
- 用0 ~ 5来表示用户对商品的评价,标准如下。
商品记录 | 评分 |
---|---|
商品未购买 | 0 |
商品已浏览 | 1 |
商品已收藏 | 2 |
商品已购买 | 3 |
商品已好评 | 4 |
商品追评为好评 | 5 |
- 程序**创建了7个用户和6个商品。7个用户即 A,B,C,D,E,F,G;6个商品即soap ,book,football,basketball ,tissue,lamp。
- 对于稀疏数据集,基于物品的过滤算法要优于基于用户过滤的算法,对于密集数据集,两者效果几乎相同。
>>>getRecsByUsers(users,'G')
['lamp', 'soap', 'football']
>>>getRecsByItems(users,'G')
['lamp', 'football', 'soap']