A Receiver Operating Characteristic (ROC) curve is a plot that illustrates the performance of a binary classifier system, and plots the true positive rate against the false positive rate for different cut points. We most commonly use this plot to calculate the Area Under Curve (AUC) to measure the performance of a classification model. In this recipe, we will demonstrate how to illustrate an ROC curve and calculate the AUC to measure the performance of a classification model.
In this recipe, we will continue using the telecom churn
dataset as our example dataset.
Perform the following steps to generate two different classification examples with different costs:
- First, you should install and load the
ROCR
package:
> install.packages("ROCR")> library(ROCR)
- Train the svm model using the training dataset with a probability equal to
TRUE
:
> svmfit=svm(churn~ ., data=trainset, prob=TRUE)
- Make predictions based on...