example = np.array([7,4,3,2,4,5,3,6,7,4,2,3,5,6,8,4]) example = example.reshape(1, -1) prediction = clf.predict(example) print(prediction) # shouldn't error anymore
Here is what the above code is Doing:
1. We’re creating a new array of data that we want to predict.
2. We’re reshaping the array to be a 2D array.
3. We’re using the predict method to predict the class of the new data.