I have built a classification model to predict binary class. I can calculate precision, recall, and F1-Score. Now, I want to generate ROC for better understanding the classification performance of my classification model. I do not know how to calculate TPR and FPR for different threshold values.


To calculate TPR and FPR for different threshold values, you can follow the following steps:

  1. First calculate prediction probability for each class instead of class prediction.

  2. Sorting the testing cases based on the probability values of positive class (Assume binary classes are positive and negative class).

  3. Then set the different cutoff/threshold values on probability scores and calculate TPR=(TP/(TP+FP)) and FPR =(FP/(FP+TN)) for each threshold value.

| improve this answer | |
  • $\begingroup$ Thanks for your answer. Would you please help me by providing an example for the step 3. $\endgroup$ – Bador Uddin Nov 6 '18 at 12:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.