What Precision, Recall, F1 Score and Accuracy Can Tell You ?

Source: Deep Learning on Medium

What Precision, Recall, F1 Score and Accuracy Can Tell You ?

There is no doubt that to evaluate your classification algorithm you have to take accuracy into consideration. but, is accuracy everything ?

Firstly, What Is Accuracy ?

Accuracy is the number of correct predictions divided by the total number of predictions.

Accuracy = correct_preds / all_preds .

Imagine testing a model on a dataset consists of 90% dog images and only 10% cat images, what if all of the predictions it gives you are dogs ? you would easily get a 90% accuracy, Even if the accuracy is high, this still would be a poor model.

Accuracy tells you how good your model is performing generally. However, it does not give detailed information.

True Positive vs True Negative

A true positive is an outcome where the model correctly predicts the positive class.

a true negative is an outcome where the model correctly predicts the negative class.

False Positive vs False Negative

A false positive is an outcome where the model incorrectly predicts the positive class.

A false negative is an outcome where the model incorrectly predicts the negative class.

Precision

Precision is how often the model is accurate when it predicts positive.

Precision = true positive / ( true positive + false positive)

low precision tells you that there’s a high false positives rate.

Recall

Recall is what proportion of actual positives was classified correctly?

Recall = true positive / ( true positive + false negative)

low recall tells you that there’s a high false negatives rate.

F1 score

F1 is an overall measure of a model’s accuracy that combines precision and recall.

F1 = 2 * (precision * recall)/(precision + recall)

High F1 score means that you have low false positives and low false negatives.

Conclusion

1 – Accuracy is suitable with balanced dataset when there are an equal number of observations in each class which isn’t common in real-life problems.

2 – Precision is important when the cost of false positives is high.

3 – Recall is important when the cost of false negatives is high.

4 – F1 score considers both the precision and recall.