Open nghiattran opened 7 years ago
In knn.ipynb file, you have:
y_cross_validation_pred = classifier_k.predict_labels(X_train_folds[n], k)
This is incorrect because predict_labels takes in a distance matrix but you pass in a raw test matrix. So, you need to have an additional step as:
predict_labels
dists = classifier.compute_distances_no_loops(X_train_folds[n]) y_cross_validation_pred = classifier_k.predict_labels(dists, k)
Or you can use predict function in k_nearest_neighbor which technically does the same thing:
predict
k_nearest_neighbor
y_cross_validation_pred = classifier_k.predict(dists, k)
@nghiattran Yes but if you use the predict function then you would pass in the raw test matrix, not the distance matrix
In knn.ipynb file, you have:
This is incorrect because
predict_labels
takes in a distance matrix but you pass in a raw test matrix. So, you need to have an additional step as:Or you can use
predict
function ink_nearest_neighbor
which technically does the same thing: