Confusion Matrix
Confusion Matrix
3
2
Accuracy : total number of two correct predictions (TP + TN) divided by the total number of a
dataset (P + N).
Specificity : correct negative prediction / Total negatives
1. Confusion Matrix:
A confusion matrix provides a easy summary of the predictive results in a classification problem.
Correct and incorrect predictions are summarized in a table with their values and broken down by
each class.
We can not rely on a single value of accuracy in classification when the classes are imbalanced. For
example, we have a dataset of 100 patients in which 5 have diabetes and 95 are healthy. However, if
our model only predicts the majority class i.e. all 100 people are healthy even though we have a
classification accuracy of 95%. Therefore, we need a confusion matrix.
False Positive (Type 1 Error): You predicted positive and it’s false. You predicted that animal is a
cat but it actually is not (it’s a dog).
False Negative (Type 2 Error): You predicted negative and it’s false. You predicted that animal is
not a cat but it actually is.
Classification Accuracy:
Classification Accuracy is given by the relation:
F-score or F1-score:
It is difficult to compare two models with different Precision and Recall. So to make them
comparable, we use F-Score. It is the Harmonic Mean of Precision and Recall. As compared to
Arithmetic Mean, Harmonic Mean punishes the extreme values more. F-score should be high.
Specificity:
Specificity determines the proportion of actual negatives that are correctly identified.