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.
Asked
Active
Viewed 9,406 times
2 Answers
6
To calculate TPR and FPR for different threshold values, you can follow the following steps:
First calculate prediction probability for each class instead of class prediction.
Sorting the testing cases based on the probability values of positive class (Assume binary classes are positive and negative class).
Then set the different cutoff/threshold values on probability scores and calculate $TPR= {TP \over (TP \ + \ FP)}$ and $FPR = {FP \over (FP \ + \ TN)}$ for each threshold value.
Ethan
- 1,625
- 8
- 23
- 39
Radia Karim
- 158
- 4
-
Thanks for your answer. Would you please help me by providing an example for the step 3. – Bador Uddin Nov 06 '18 at 12:08
0
The above answer calculates TPR incorrectly. It should be $TPR = {TP \over (TP \ + \ FN)}$. What $TP \over (TP \ + \ FP)$ calculates is the precision.
Ethan
- 1,625
- 8
- 23
- 39
Yuhang Lin
- 1
- 1