From 2a3eac311954cfb10d7534f7601bf0b35f2247db Mon Sep 17 00:00:00 2001 From: Arab Myla <myla.arab@ecl19.ec-lyon.fr> Date: Wed, 2 Nov 2022 19:50:50 +0000 Subject: [PATCH] Update knn.py --- knn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/knn.py b/knn.py index 90154a7..06fadfb 100644 --- a/knn.py +++ b/knn.py @@ -21,7 +21,7 @@ def knn_predict(dists,labels_train,k): labels_predict = np.zeros(num_test) for i in range(num_test): L = [] - # L = list storing the labels of the k nearest neighbors to the ith test point + # L = list storing the labels of the k nearest neighbors to the ith test point L = labels_train[np.argsort(dists[i])][0:k] labels_predict[i] = np.argmax(np.bincount(L)) return labels_predict -- GitLab