【发布时间】:2013-07-23 09:02:12
【问题描述】:
import numpy
from scipy.spatial.distance import pdist
X = numpy.zeros(50000,25)
C = pdist(X, 'euclidian')
我要找:
然后 numpy 给出错误:数组太大。
我认为问题在于 C 的数组大小。Pdist 无法创建 (50000,50000) 数组。我不知道为什么 numpy 限制?我可以在 matlab 中运行相同的代码。如何使用数组运行此代码?
而且,我发现可能存在重复,但它们的数组矩阵太大了。
Is it possible to create a 1million x 1 million matrix using numpy? Very large matrices using Python and NumPy
【问题讨论】:
-
您计算过要分配多少内存吗?
-
你使用的是 64 位版本的 python 和 numpy 吗?一个 50k x 50k 的数组将使用大约 20Gb 的内存(numpy 默认使用双精度浮点)。