我正在尝试为我的 10 维数据集生成一个网格,同时我遵循来自http://pybrain.org/docs/tutorial/fnn.html的代码。我正在实现并引发错误的代码是:
ticks = arange(-3.,6.,0.2)
X, Y = meshgrid(ticks, ticks)
# need column vectors in dataset, not arrays
griddata = ClassificationDataSet(10,1, nb_classes=3)
for i in xrange(X.size):
griddata.addSample([X.ravel()[i],Y.ravel()[i]], [0])
我得到的错误是:
File "a.py", line 224, in <module>
griddata.addSample([X.ravel()[i], Y.ravel()[i]], [0])
File "a.py", line 45, in addSample
self.appendLinked(inp, target)
File "a.py", line 216, in appendLinked
self._appendUnlinked(l, args[i])
File "a.py", line 198, in _appendUnlinked
self.data[label][self.endmarker[label], :] = row
ValueError: cannot copy sequence with size 2 to array axis with dimension 7
我不知道如何纠正错误。