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

提供推荐 | 广阔天地,大有作为 #4

Open
laiqun opened this issue Nov 6, 2017 · 7 comments
Open

提供推荐 | 广阔天地,大有作为 #4

laiqun opened this issue Nov 6, 2017 · 7 comments

Comments

@laiqun
Copy link
Owner

laiqun commented Nov 6, 2017

https://laiqun.github.io/2017/11/05/Marking-Recommendations/

@SofiaxCh
Copy link

SofiaxCh commented Nov 6, 2017

比课本讲的好不过,协方差是怎么求来着完全忘记了:(

@laiqun
Copy link
Owner Author

laiqun commented Nov 6, 2017

@SofiaxCh 那你看了这篇文章,记起来没有?

@SofiaxCh
Copy link

SofiaxCh commented Nov 7, 2017

HHHa 你那段解释写的很好,我就记住了向量标准化再cos的公式,可以嘛?要用的时候应该调Numpy库就可以啦

@laiqun
Copy link
Owner Author

laiqun commented Nov 7, 2017

皮尔逊相似度,就是概率论的相关系数。皮尔逊是个人名,这个相关系数的公式是他发明的。也就是向量标准化再求余弦。两个是一样的。学会一个就会另一个。

from numpy import *
vc=[1,2,39,0,8]
vb=[1,2,38,0,8]
mean(multiply((vc-mean(vc)),(vb-mean(vb))))/(std(vb)*std(vc))
#0.999986231331    
#numpy.corrcoef得到相关系数矩阵(向量的相似程度)
numpy.corrcoef(vc,vb)
#[[ 1.          0.99998623]   
# [ 0.99998623  1.        ]]
# 这里得到是相关系数矩阵
#左上角的[0][0]代表第一行和第一行的相关系数,[0][1]代表第一行和第二行的相关系数
#左下角的[1][0]代表第二行和第一行的相关系数,[1][1]代表第二行和第二行的相关系数

@SofiaxCh
Copy link

SofiaxCh commented Nov 9, 2017

李教授写的好细致哦,这次马马虎虎看懂了,那个,标准差公式是不是掉了一个平方呀?

@laiqun
Copy link
Owner Author

laiqun commented Nov 9, 2017

@SofiaxCh 还真是这样子呐!能发现错误,很棒!

@laiqun
Copy link
Owner Author

laiqun commented Nov 16, 2017

算物品与物品的相似度,还可以给用户提供相似推荐

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

No branches or pull requests

2 participants