https://colab.research.google.com/drive/1hMIsekh284z-4Ele2MfmAduOXId7Mr_G?usp=sharing
Please help me with the error
@kushidhar0873 Hey,
The predict function in your class is written for a single datapoint p. While, when you are calling-
knn_model.predict(X_test)
you are passing the entire test dataset which has multiple samples. Try to call your predict function in this manner:
predictions = []
for pt in X_test:
predictions.append(knn_model.predict(pt))
predictions[i] represents the predicted category of ith sample in X_test.