A receiver operating characteristic (ROC) curve is a 2-dimensional plot of the (the true positive rate) versus (1 minus the true negative rate) of a binary classifier while varying its discrimination threshold. In statistics and machine learning, a basic and popular tool for binary classification* is logistic regression, and an ROC curve is a useful way to assess the predictive accuracy of the logistic regression model.
To illustrate with an example, let’s consider the Bernoulli response variable and the covariates . A logistic regression model takes the covariates as inputs and returns . You as the user of the model must decide above which value of you will predict that ; this value is the discrimination threshold. A common threshold is .
Once you finish fitting the model with a training set, you can construct an ROC curve by following these steps below:
- Set a discrimination threshold.
- Use the covariates to predict for each observation in a validation set.
- Since you have the actual response values in the validation set, you can then calculate the sensitivity and specificity for your logistic regression model at that threshold.
- Repeat Steps 1-3 with a new threshold.
- Plot the values of versus for all thresholds. The result is your ROC curve.
The use of a validation set to assess the predictive accuracy of a model is called validation, and it is a good practice for supervised learning. If you have another fresh data set, it is also good practice to use that as a test set to assess the predictive accuracy of your model.
Note that you can perform Steps 2-5 for the training set, too – this is often done in statistics when you don’t have many data to work with, and the best that you can do is to assess the predictive accuracy of your model on the data set that you used to fit the model.
*Strictly speaking, logistic regression is a regression technique, not a classification technique. However, when combined with a decision rule about the probability of success, logistic regression is commonly used for binary classification.
Recent Comments