title: Computation of Error rate in nearest neighbor classification algorithm
body: <p>I am trying to find the optimal value of K for K Nearest Neighbor Algorithm.
  I am been running this classification method on Matlab for different number of classes members
  but I need to calculate the error rate when we use different value of K.
  I am trying to use this idea as example:</p>
  
  <p>I have the following data set:</p>
  
  <p>1 3 1</p>
  
  <p>2 3 2</p>
  
  <p>2 1 2</p>
  
  <p>3 3 2</p>
  
  <p>3 4 1 </p>
  
  <p>3 3 2</p>
  
  <p>2 2 2</p>
  
  <p>Where the first column is the x axis the second it y axis the third is the label
  of the class and I need to classify point (x,y) using K-NN algorithm. I am using different values of K. 
  My question is if I know that that point (4,1) is not included in the source dataset 
  but I know that it is from the class label 1. How can I compute the error rate of the 
  certain K value based on method Leave-one-out-cross-validation. </p>
  
  <p>Thank you a lot in advance </p>
  
  <p>Regards</p>
  
  <p>Rinadi</p>