小编bat*_*n08的帖子

找到相关矩阵

我有一个相当大的矩阵(大约50K行),我想打印矩阵中每行之间的相关系数.我编写了这样的Python代码:

for i in xrange(rows): # rows are the number of rows in the matrix. 
    for j in xrange(i, rows):
        r = scipy.stats.pearsonr(data[i,:], data[j,:])
        print r  
Run Code Online (Sandbox Code Playgroud)

请注意,我正在使用pearsonrscipy模块提供的功能(http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.pearsonr.html).

我的问题是:有更快的方法吗?我可以使用一些矩阵分区技术吗?

谢谢!

python algorithm scipy

11
推荐指数
3
解决办法
1万
查看次数

标签 统计

algorithm ×1

python ×1

scipy ×1