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
knn_isolet
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
pred_knn
解决方案
There's several steps to solve in order to get you a ROC curve here. I am just going to make up some data since you did not provide an easy way of getting the data you are using. Note that the ROCR package wants the class labels to be positive/negative, not factors, so let's make them like that.
# Gener