我正在尝试使用Stephan Marslands 2D 自组织图(结合主成分分析)
import som as sm
#put it into som
def som_algorithm(inputs,nIterations,x=0,y=0):
print "Running Self-Organizing Map!"
if x == 0 and y == 0:
y = len(inputs[0])
x = len(inputs)
print "x axis is " + str(x) + " / y axis is " + str(y)
som = sm.som(x,y,inputs)
som.somtrain(inputs, nIterations)
print som.somfwd(inputs)
som_algorithm(training, 100)
并根据我预处理后的数据集,产生此错误
Running Self-Organizing Map!
x axis is 600 / y axis is 173
Traceback (most recent call last):
File "\source\bag_of_words.py", line 112, in <module>
som_algorithm(training, 100)
File "\source\bag_of_words.py", line 87, in som_algorithm
som = sm.som(x,y,inputs)
File "\som\__init__.py", line 44, in __init__
self.mapDist = zeros((self.x*self.y,self.x*self.y))
MemoryError
目前,myY
表示每个数组的元素数量(数组维度包含在较大维度中),myX
表示包含较小数组维度的较大维度。什么可能导致此内存错误?