So basically I am having two numpy arrays x_chunk and y_chunk of dimensions [10,512,512,50] each. I converted them, to dimensions [10,13107200] using the code:

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

Now I am using skmultiflow KNN Classifier, and trying to fit these data using partial_fit

model.partial_fit(x_chunk, y_chunk)

But I am getting this error:

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

It says that the dimension of the arrays should be same, however both arrays are of same dimensions, so what is the problem?

edit

Model which I used is:

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

0 Answers