Confusion Matrix: Example Table of Confusion References External Links
Confusion Matrix: Example Table of Confusion References External Links
In the field of machine learning and specifically the problem of statistical classification, a confusion matrix, also known as an error matrix,[4] is a
specific table layout that allows visualization of the performance of an algorithm, typically a supervised learning one (in unsupervised learning it is
usually called a matching matrix). Each row of the Matrix represents the instances in a predicted class while each column represents the instances in an
actual class (or vice versa).[2] The name stems from the fact that it makes it easy to see if the system is confusing two classes (i.e. commonly mislabeling
one as another).
It is a special kind of contingency table, with two dimensions ("actual" and "predicted"), and identical sets of "classes" in both dimensions (each
combination of dimension and class is a variable in the contingency table).
Contents
Example
Table of confusion
References
External links
Example
If a classification system has been trained to distinguish between cats, dogs and rabbits, a confusion matrix will summarize the results of testing the
algorithm for further inspection. Assuming a sample of 27 animals — 8 cats, 6 dogs, and 13 rabbits, the resulting confusion matrix could look like the
table below:
Actual class In this confusion matrix, of the 8 actual cats, the system predicted that
three were dogs, and of the six dogs, it predicted that one was a rabbit
Cat Dog Rabbit and two were cats. We can see from the matrix that the system in
Cat 5 2 0 question has trouble distinguishing between cats and dogs, but can
Predicted
make the distinction between rabbits and other types of animals pretty
class
Dog 3 3 2 well. All correct predictions are located in the diagonal of the table
(highlighted in bold), so it is easy to visually inspect the table for
Rabbit 0 1 11 prediction errors, as they will be represented by values outside the
diagonal.
Table of confusion
In predictive analytics, a table of confusion (sometimes also called a confusion matrix), is a table with two rows and two columns that reports the
number of false positives, false negatives, true positives, and true negatives. This allows more detailed analysis than mere proportion of correct
classifications (accuracy). Accuracy is not a reliable metric for the real performance of a classifier, because it will yield misleading results if the data set
is unbalanced (that is, when the numbers of observations in different classes vary greatly). For example, if there were 95 cats and only 5 dogs in the data,
a particular classifier might classify all the observations as cats. The overall accuracy would be 95%, but in more detail the classifier would have a 100%
recognition rate (sensitivity) for the cat class but a 0% recognition rate for the dog class. F1 score is even more unreliable in such cases, and here would
yield over 97.4%, whereasinformedness removes such bias and yields 0 as the probability of an informed decision for any form of guessing (here always
guessing cat).
Assuming the confusion matrix above, its corresponding table of confusion, for the cat class, would be:
Actual class
Cat Non-cat
Predicted
accuracy (ACC)
F1 score
is the harmonic mean of precision and sensitivity
Markedness (MK)
Sources: Fawcett (2006), Powers (2011), and Ting (2011) [1] [2] [3]
True condition
Prevalence Accuracy (ACC) =
Total
Condition positive Condition negative
population = ΣΣCondition positive
Total population
Σ True positive + Σ True negative
Σ Total population
References
1. Fawcett, Tom (2006). "An Introduction to ROC Analysis"(http://people.inf.elte.hu/kiss/11dwhdm/roc.pdf)(PDF). Pattern Recognition
Letters. 27 (8): 861–874. doi:10.1016/j.patrec.2005.10.010(https://doi.org/10.1016%2Fj.patrec.2005.10.010)
.
2. Powers, David M W (2011)."Evaluation: From Precision, Recall and F-Measureto ROC, Informedness, Markedness & Correlation"(htt
p://www.flinders.edu.au/science_engineering/fms/School-CSEM/publications/tech_reps-research_artfcts/TRRA_2007.pdf)
(PDF).
Journal of Machine Learning Technologies. 2 (1): 37–63.
3. Ting, Kai Ming (2011). Encyclopedia of machine learning(https://link.springer.com/referencework/10.1007%2F978-0-387-30164-8).
Springer. ISBN 978-0-387-30164-8.
4. Stehman, Stephen V. (1997). "Selecting andinterpreting measures of thematic classification accuracy".Remote Sensing of
Environment. 62 (1): 77–89. doi:10.1016/S0034-4257(97)00083-7(https://doi.org/10.1016%2FS0034-4257%2897%2900083-7) .
External links
Theory about the confusion matrix
GM-RKB Confusion Matrix concept page
Text is available under theCreative Commons Attribution-ShareAlike License ; additional terms may apply. By using this site, you agree to
the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of theWikimedia Foundation, Inc., a non-profit organization.