0

所以基本上我有两个 numpy 数组x_chunk和每个y_chunk维度[10,512,512,50]。我使用代码将它们转换为尺寸[10,13107200]

x_chunk=x_chunk.reshape(10,13107200)
y_chunk=y_chunk.reshape(10,13107200)

现在我正在使用skmultiflow KNN Classifier,并尝试使用来拟合这些数据partial_fit

model.partial_fit(x_chunk, y_chunk)

但我收到此错误:

ValueError                                Traceback (most recent call last)
<ipython-input-26-d3e5ffef750e> in <module>()
     53     x_chunk=x_chunk.reshape(10,13107200)
     54     y_chunk=y_chunk.reshape(10,13107200)
---> 55     model.partial_fit(x_chunk, y_chunk)
     56     n_loop += 1
     57 

/usr/local/lib/python3.6/dist-packages/skmultiflow/lazy/knn.py in partial_fit(self, X, y, classes, weight)
    178 
    179         for i in range(r):
--> 180             self.window.add_element(np.asarray([X[i]]), np.asarray([[y[i]]]))
    181         return self
    182 

/usr/local/lib/python3.6/dist-packages/skmultiflow/utils/data_structures.py in add_element(self, X, y)
    968             raise TypeError("None type not supported as the buffer, call configure() to set up the InstanceWindow")
    969 
--> 970         aux = np.concatenate((X, y), axis=1)
    971         self._buffer = np.concatenate((self._buffer, aux), axis=0)
    972         self._n_samples += 1

ValueError: all the input arrays must have same number of dimensions

它说数组的维度应该相同,但是两个数组的维度相同,那么问题是什么?

编辑

我使用的模型是:

from skmultiflow.lazy import KNN
model = KNN(n_neighbors=8, max_window_size=2000, leaf_size=40)
4

0 回答 0