Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

很好的协同过滤入门学习算法,但是有几个问题和错误 #10

Open
life-is-short-play-dota opened this issue Mar 18, 2021 · 1 comment

Comments

@life-is-short-play-dota

首先计算相似度并没有用用户-电影矩阵,而是用的用户共现矩阵,即看过相同电影的用户值为1,没有看过相同电影的用户值不是0而是根本不存在,这就导致evaluate()函数里如果for i, user in self.testSet.items(),会出现需要计算的用户在相似度矩阵里根本不存在的问题,会返回字典值错误 keyError,错误值就是想要计算却不存在的那个用户id。因此,在构建共现矩阵(co-rated matrix)的时候,如果u == v, 不应该直接continue,而是应该设为0值。

第二个问题就是这个协同过滤的计算准确率很低,用共现矩阵相当于根本没考虑电影的任何属性,只考虑了电影名,随便换个数据集就会出问题,我换了一个图书馆的图书数据集测试,推荐的准确率低的离谱。

@Istari000
Copy link

非常感谢,因为随机出现的keyError看了好几周,修改构建共现矩阵部分后现在能跑了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants