计算相关系数python或grphlab

时间:2016-03-22 20:05:29

标签: python correlation

假设我们在GraphLab SFrame1SFrame2中有两个'SFrame',其中包含数值数组。我想计算两个向量之间的相关系数。这是我的工作:

import numpy as np
a = data_All_Features_rating1000_top5_nr['n_r'].to_numpy
b = data_All_Features_rating1000_top5_nr['n_r'].to_numpy

np.corrcoef(a,b)

我收到此错误:

TypeError: unsupported operand type(s) for /: 'instancemethod' and 'int'

ab包含整数值:

print a
print b
<bound method SArray.to_numpy of dtype: int
Rows: 5
[77887, 76271, 67092, 56837, 54695]>
<bound method SArray.to_numpy of dtype: int
Rows: 5
[77887, 76271, 67092, 56837, 54695]>

如何简单计算上述两个向量之间的线性相关系数?感谢

0 个答案:

没有答案