假设我们在GraphLab SFrame1
和SFrame2
中有两个'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'
a
和b
包含整数值:
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]>
如何简单计算上述两个向量之间的线性相关系数?感谢