让's say we have two '在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]>
如何简单地计算上述两个向量之间的线性相关系数?谢谢