Skip to content

Commit

Permalink
fixed tie handling
Browse files Browse the repository at this point in the history
  • Loading branch information
VarIr committed Nov 5, 2015
1 parent 7d91060 commit 229d88e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions knn_classification.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 229d88e

Please sign in to comment.