diff --git a/knn_classification.m b/knn_classification.m index 123a0ae..5e248d4 100644 --- a/knn_classification.m +++ b/knn_classification.m @@ -52,11 +52,11 @@ % "tie": use nearest neighbor if (length(id) > 1) - if (seed_class == nn_class) + if (seed_class == nn_class(1)) acc(j) = acc(j) + 1/n; corr(i,j) = 1; end - cmat(seed_class, nn_class) = cmat(seed_class, nn_class) + 1; + cmat(seed_class, nn_class(1)) = cmat(seed_class, nn_class(1)) + 1; % majority vote else