in the field of machine learning, a confusion matrix, also known as a contingency table or an error matrix  , 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 column of the matrix represents the instances in a predicted class, while each row represents the instances in an actual class. 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). == 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 &mdash; 8 cats, 6 dogs, and 13 rabbits, the resulting confusion matrix could look like the table below: {| |- | {| class="wikitable" style="border:none; float:left; margin-top:0;" !style="background:white; border:none;" colspan="2" rowspan="2"| !colspan="3" style="background:none;"| predicted class |- !cat !dog !rabbit |- !rowspan="3" style="height:6em;"|actual class !cat |5 |3 |0 |- !dog |2 |3 |1 |- !rabbit |0 |2 |11 |} |- | 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 and two were cats. we can see from the matrix that the system in question has trouble distinguishing between cats and dogs, but can make the distinction between rabbits and other types of animals pretty well. all correct guesses are located in the diagonal of the table, so it's easy to visually inspect the table for 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 guesses (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 number of samples in different classes vary greatly). for example, if there were 95 cats and only 5 dogs in the data set, the classifier could easily be biased into classifying all the samples as cats. the overall accuracy would be 95%, but in practice the classifier would have a 100% recognition rate for the cat
Machine_learning Statistical_classification