Confusion matrix
lastmod 2026-05-13created 2014-11-0113 edits
A confusion matrix, also called a Contingency table or An error matrix, is widely used as a metric mainly when evaluating the performance of an algorithm.
In Korean it is called 오차행렬 (ochahaengnyeol, "error matrix"), 분류행렬 (bullyuhaengnyeol, "classification matrix"), 혼동행렬 (hondonghaengnyeol, "confusion matrix"), and so on. (The exact Korean name is unknown)
Categoreis
- Precision and recall
- F1 - A metric for evaluating a model's accuracy
Terminology and derivations
- true positive (TP)
- eqv. with hit
- true negative (TN)
- eqv. with correct rejection
- false positive (FP)
- eqv. with false alarm, Type I error
- false negative (FN)
- eqv. with miss, Type II error
Table of confusion
| Predicted | |||
| P' | n' | ||
| Actual | P | TP | FN |
| n | FP | TN | |
In a confusion matrix, 'True/False' indicates whether the actual value, 1 or 0, was guessed correctly. That is, 'True' is when the actual and predicted values match, and 'False' is when they don't. 'Positive/Negative' indicates whether the predicted value is 1 or 0.
- <span style="background:green;">TP: predicted 1, and it is actually 1 (correct)
- <span style="background:green;">TN: predicted 0, and the actual value is also 0 (correct)
- <span style="background:red;">FP: predicted 1, but the actual value is 0,
- <span style="background:red;">FN: predicted 0, but it is actually 1,
- Precision
-
TP / TP+FP - That is, of those predicted as 1, the ones whose actual value is 1 --> the number of correct answers among the problems I solved (closer to 1 is better)
- Recall (=sensitivity)
-
TP / TP+FN - That is, of those whose actual value is 1, the ones predicted as 1 --> how many of all the 1s I got right (closer to 1 is better)
- Accuracy (how many of all were predicted correctly)
-
TP + TN / TP+TN+FP+FN - That is, the proportion of all cases that came out True (closer to 1 is better)
Terms
- allAcc (Overall Accuracy, Pixel/Point Accuracy)
- mAcc (mean Accuracy, mean Class Accuracy)
- mIoU (mean Intersection over Union)
See also
Favorite site
- Wikipedia (en) article on the confusion matrix
- How to read a confusion matrix
- [Recommended] About the confusion matrix 1
References
-
Kmkim1222-Confusion_matrix.pdf ↩