I'm trying to draw the ROC curve for the results of my Naive Bayes classifier.
attach(TrainFactor)
NB <- naiveBayes(Result~., data=TrainFactor)
NB_pred <- predict(NB, TestFactor, type = c("class"))
NB_table <- table(NB_pred, TestFactor[,31])
## ROC
NB_predictiontest <- prediction(NB_pred,TestFactor$Result)
NB_perftest <- performance(NB_predictiontest,"tpr","fpr")
plot(NB_perftest,col="blue",lwd=2, main="Naive Bayes ROC Curve")
But I get an error when I try to execute the "prediction" function:
Error in prediction(NB_pred, TestFactor[, 31]) :
Format of predictions is invalid.
Can anyone help me with this?