xingzhexiaozhu / movierecommendation Goto Github PK
View Code? Open in Web Editor NEWUserCF和ItemCF协同过滤推荐算法的实现
UserCF和ItemCF协同过滤推荐算法的实现
for i, user, in enumerate(self.trainSet): 是否应该是改成for i, user, in enumerate(self.testSet):
由于数据格式是
用户,电影,评分,时间
itemCF代码中划分测试集,训练集的方式
会让同一个用户的行为被分割到不同数据集中
可能影响整个过程,麻烦看一下
请问怎么联系你?有qq?可以把数据集发给我吗?谢谢
对于不同的用户,怎样返回推荐的电影呢
你好!非常感谢你的代码。但是我认为你的代码中有一些错误。
第一,在recommend()函数中,rank[movie] += wuv这一句有问题,缺少用户对电影的评分。
第二,在计算指标时(以准确率为例),不能根据测试用户是否观看过所推荐的电影作为分子,造成指标偏低。
首先计算相似度并没有用用户-电影矩阵,而是用的用户共现矩阵,即看过相同电影的用户值为1,没有看过相同电影的用户值不是0而是根本不存在,这就导致evaluate()函数里如果for i, user in self.testSet.items(),会出现需要计算的用户在相似度矩阵里根本不存在的问题,会返回字典值错误 keyError,错误值就是想要计算却不存在的那个用户id。因此,在构建共现矩阵(co-rated matrix)的时候,如果u == v, 不应该直接continue,而是应该设为0值。
第二个问题就是这个协同过滤的计算准确率很低,用共现矩阵相当于根本没考虑电影的任何属性,只考虑了电影名,随便换个数据集就会出问题,我换了一个图书馆的图书数据集测试,推荐的准确率低的离谱。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.