ML-Lecture-11-Evaluation
ML-Lecture-11-Evaluation
Email: [email protected]
Common Evaluation Metrics for
Classification
1. Confusion Matrix
2. Accuracy
3. Precision
4. Recall/𝑆𝑒𝑛𝑠𝑖𝑡𝑖𝑣𝑖𝑡𝑦
5. Specificity
6. F1 Score
7. ROC (Receiver Operating Characteristics) Curve
8. AUC (Area Under the ROC curve) Score
Confusion Matrix
A confusion matrix is a table that describes
the performance of a classification model
on the test data
It is an N X N matrix, where N is the number
of classes being predicted
Each row of the matrix represents the
instances in a predicted class while each
column represents the instances in an
actual class (and vice versa).
Terms associated with Confusion matrix
True Positives : The cases in which the model
predicted 1(True) and the actual output was
also 1(True).
True Negatives : The cases in which the model
predicted 0(False) and the actual output was
also 0(False).
False Positives : The cases in which the model
predicted 1(True) and the actual output was
0(False).
False Negatives : The cases in which the model
predicted 0(False) and the actual output was
1(True).
Accuracy
It is the ratio of number of correct predictions to the total
number of input samples (predictions).
𝑁𝑜. 𝑜𝑓 𝑐𝑜𝑟𝑟𝑒𝑐𝑡 𝑝𝑟𝑒𝑑𝑖𝑐𝑡𝑖𝑜𝑛𝑠
𝐴𝑐𝑐𝑢𝑟𝑎𝑐𝑦 =
𝑇𝑜𝑡𝑎𝑙 𝑛𝑜. 𝑜𝑓 𝑝𝑟𝑒𝑑𝑖𝑐𝑡𝑖𝑜𝑛𝑠
𝑇𝑃 + 𝑇𝑁
=
𝑇𝑃 + 𝐹𝑃 + 𝐹𝑁 + 𝑇𝑁
55
= = 0.9649
57
Accuracy = 93%
Error = 7%
Recall/Sensitivity
Out of all the positive classes, how many are
predicted correctly
𝑇𝑃
𝑅𝑒𝑐𝑎𝑙𝑙 =
𝑇𝑃 + 𝐹𝑁
55
= = 0.9166
60
Accuracy = 93%
Error = 7%
Specificity
Out of all the negative classes, how many are
predicted correctly
𝑇𝑁
𝑆𝑝𝑒𝑐𝑖𝑓𝑖𝑐𝑖𝑡𝑦 =
𝐹𝑃 + 𝑇𝑁
38
= = 0.95
40
Accuracy = 93%
Error = 7%
F1 Score
Harmonic mean of the Precision and Recall
F1 =
F1 = 0.94