Understanding Accuracy, Precision & Recall under 5 Minutes.

Aditya Pasalapudi
2 min readSep 8, 2019

--

I often get confused to understand the terms in the famous Confusion Matrix. Is false negative good or bad? Confusion Matrix comprises four terms — True Positive, True Negative, False Positive, and False Negative. Let us understand the structure of the term True Positive. It contains two parts: <TRUE> and <Positive>. The first part corresponds to whether the machine has labelled the sample right. The second part refers to the output of the prediction. Now, with this terminology, let us understand what all four terms correspond to.

  1. True Positive (TP): Machine predicted the output correctly (TRUE) and labelled the result as positive.
  2. True Negative (TN): Machine predicted the output correctly (TRUE) and labelled the result as negative.
  3. False Positive (FP): Machine predicted the output incorrectly (FALSE) and the labelled the result as positive. The original sample is negative, and the model predicted it as positive.
  4. False Negative (FN): Machine predicted the output incorrectly (FALSE) and labelled the result as negative. The original sample is positive, and the model predicted it as negative.

What is the accuracy of the system?

In layman terms, it is a measure that determines how correctly the learning regression model has predicted both the positive and negative samples. TP + TN are the correctly predicted samples. Hence, the formula is:

Accuracy of a machine learning classification model.

Can someone game the accuracy of the learning model and claim that their model is superior to others? The answer is YES. If you have an imbalanced dataset with 99% positive samples and 1% negative samples, we can game the system by always returning the result as positive and can claim 99% accuracy. Precision and recall are alternative measures to predict the accuracy of a model.

Precision is — out of all my positive samples, how many did my model labelled as positive. That means the proportion of positive labels that are identified correctly.

Precision Formula

Recall is — how many positive labelled are positive samples? Understand this metric more like how many times do we need to recall our results when we say that our result is positive.

Recall Formule

--

--