Given the following prediction Sample ID Predicted Value Ground Truth 1 0.9 1 2 0.3 1 3 0.7 1 4 0.8 -1 5 0.4 -1 6 0.2 -1 (a) (18 Pts) Using 0.5 as the cutoff value, namely, the sample is predicted as 1 if predicted value >=0.5, otherwise -1. Please compute true positive rate (tpr, also called recall/sensitivity), false positive rate (fpr), true negative rate (tnr), false negative rate (fnr), accuracy and precision, respectively.
From what I understand, the data looks like this:
Sample ID | Predicted Value | Ground Truth |
1 | 0.9 | 1 |
2 | 0.3 | 1 |
3 | 0.7 | 1 |
4 | 0.8 | -1 |
5 | 0.4 | -1 |
6 | 0.2 | -1 |
Thus, the predicted values are 1, -1, 1, 1, -1, -1.
Thus, the confusion matrix will look as so:
Predicted +1 | Predicted -1 | |
Actual +1 | 2 | 1 |
Actual -1 | 1 | 2 |
Thus,
true positive rate= tpr= 2/(2+1)
= 2/3= 0.67 or 67%
true negative rate= fpr= 2/(2+1)
= 2/3= 0.67 or 67%
false positive rate= 1- true negative rate
= 1-0.67= 0.33 or 33%
false negative rate= 1- true positive rate
= 1-0.67= 0.33 or 33%
accuracy= 4/6
= 2/3= 0.67 or 67%
precision= 2/3
= 0.67 or 67%
Get Answers For Free
Most questions answered within 1 hours.