I am using sklearn's nearest neighbor for a classification problem. My features are patches of the shape (3600, 2, 5). For example:
a = [[5,5,5,5,5], [5,5,5,5,5]]
b = [[5,5,5,5,5], [5,5,5,5,5]]
features = []
for i in xrange(len(a)):
features.append([a[i], b[i]]) #I have 3600 of these in reality.
neigh = KNeighborsClassifier()
neigh.fit(train_features, target_class)
predictions = neigh.predict(test_features)
I get the error:
ValueError: Found array with dim 3. Expected <= 2
This is on the line where I use neigh.fit. Target class is a 1 dimensional array with corresponding classes. The train_features, test_features are simply the data split into training and testing data.
Link to the same error: check_arrays() limiting array dimensions in scikit-learn?
Is there a fix for this?