# ROC curve for knn model

I am using ROCR package and I was wondering how can one plot a ROC curve for knn model in R? Is there any way to plot it all with this package?

I don't know how to use the prediction function of ROCR for knn. Here's my example, i am using isolet dataset from UCI repository where i renamed the class attribute as y:

cl <- factor(isolet_training$y) knn_isolet <- knn(isolet_training, isolet_testing, cl, k=2, prob=TRUE)  Now my question is, what are the arguments to pass to the prediction function of ROC. I tried the 2 below alternatives which are not working: library(ROCR) pred_knn <- prediction(knn_isolet$y, cl)
pred_knn <- prediction(knn_isolet$y, isolet_testing$y)

• ROCR is not bound to a specific model. The only information you need are the true labels and the predictions of a model. Can you please provide some code and tell us where exactly you get stuck ? – steffen Jul 31 '12 at 14:32
• @steffen i added an example – blerta Aug 1 '12 at 8:56
• you have opened a very similar question for solving the same problem. I suggest to edit this one and flag the other one for close (either you choose or the mods will ;)). I see no value to keep both open. If you do not agree, please comment. – steffen Aug 1 '12 at 12:47