推荐系统(一):使用Surprise库建立推荐系统 —— MovieLens电影推荐

版权声明:本文为博主原创文章,未经博主允许不得转载



一、Surprise介绍

  • Surprise是一个基于Python scikit构建和分析推荐系统。
  • Surprise(Simple Python Recommendation System Engine)是一款推荐系统库,是scikit系列中的一个。
  • 简单易用,同时支持多种推荐算法:基础算法、基于近邻方法(协同过滤)、矩阵分解等(SVD, PMF, SVD++, NMF)

二、设计surprise时考虑到以下目的

  • 让用户完美控制他们的实验。为此,特别强调文档,试图通过指出算法的每个细节尽可能清晰和准确。
  • 减轻数据集处理的痛苦。用户可以使用内置数据集(Movielens, Jester)和他们自己的自定义数据集。
  • 提供各种即用型预测算法, 例如:基线算法, 邻域方法,基于矩阵因子分解( SVD, PMF, SVD ++,NMF)等等。此外, 内置了各种相似性度量(余弦,MSD,皮尔逊…)。可以轻松实现新的算法思路
  • 提供评估, 分析和比较算法性能的工具。使用强大的CV迭代器(受scikit-learn优秀工具启发)以及对一组参数的详尽搜索,可以非常轻松地运行交叉验证程序 。

三、常用类

用法:surprise.prediction_algorithms.XX

算法类名 说明

random_pred.NormalPredictor

Algorithm predicting a random rating based on the distribution of the training set, which is assumed to be normal. (根据训练集的分布特征随机给出一个预测值)

baseline_only.BaselineOnly

Algorithm predicting the baseline estimate for given user and item.(给定用户和Item,给出基于baseline的估计值)

knns.KNNBasic

A basic collaborative filtering algorithm.

knns.KNNWithMeans

A basic collaborative filtering algorithm, taking into account the mean ratings of each user.(将每个用户评分的均值考虑在内的协同过滤实现)

knns.KNNBaseline

A basic collaborative filtering algorithm taking into account a baseline rating.

matrix_factorization.SVD

SVD algorithm

matrix_factorization.SVDpp

SVD++ algorithm(即LFM+SVD)

matrix_factorization.NMF

A collaborative filtering algorithm based on Non-negative Matrix Factorization.(基于矩阵分解的协同过滤)

slope_one.SlopeOne

A simple yet accurate collaborative filtering algorithm.

co_clustering.CoClustering

A collaborative filtering algorithm based on co-clustering.

其中基于近邻的方法(协同过滤)可以设定不同的度量准则,用法:surprise.similarities.XX

相似度度量标准 度量标准说明

cosine()

Compute the cosine similarity between all pairs of users (or items).(余弦相似度)

msd()

Compute the Mean Squared Difference similarity between all pairs of users (or items).(均方差异相似度)

pearson()

Compute the Pearson correlation coefficient between all pairs of users (or items).(Pearson相关系数)

pearson_baseline()

Compute the (shrunk) Pearson correlation coefficient between all pairs of users (or items) using baselines for centering instead of means.

支持不同的评估准则,用法:surprise.accuracy.XX

评估准则 准则说明 公式 意义

mse

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

InitialHeart2021

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值