title: KNN classification in MATLAB - confusion matrix and ROC?
body: <p>I'm trying to classify a data set containing two classes using different classifiers (LDA, SVM, KNN) and would like to compare their performance. I've made ROC curves for the LDA by modifying the priori probability.</p>
  
  <p>But how can i do the same for a KNN classifier?</p>
  
  <p>I searched the documentation and found some functions:</p>
  
  <ol>
  <li><code>Class = knnclassify(Sample, Training, Group, k)</code></li>
  <li><code>mdl = ClassificationKNN.fit(X,Y,'NumNeighbors',i,'leaveout','On')</code></li>
  </ol>
  
  <p>I can run (a) and get a confusion matrix by using leave-one-out cross-validation but it is not possible to change the priori probability to make an ROC?</p>
  
  <p>I haven't tried (b) before but this creates a model where you can modify the mdl.Prior. But i have no clue how to get a confusion matrix.</p>
  
  <p>Is there an option i've missed or someone who can explain how to fully use those function to get a ROC?</p>