F1-Score, Precision & Recall Explained

In this post, we will discuss F1-Score, Precision and & Recall and How these parameters are useful in machine learning or statistics in general.

Precision recall f1 score meme


It is the ratio of True positive to the Total Positive predicted points.

Precision = \( \frac{TP}{TP + FP} \)
where, TP = True Positive and FP = False Positive

In other words, Precision tells us the percentage of points correctly predicted positive points out of total positively predicted points.


It is defined as the True Positive Rate i.e, the ratio of True positive to the Total Actual Positive points.

Recall = TPR = \( \frac{TP}{TP + FN} \)
TPR = True Positive Rate
TP = True Positive
FN = False Negative

Total actual positive points = FN + TP
because FN is the number of points that are Falsely predicted Negative, and TP is the number of points that are actually positive and predicted positive.

We want Precision to be high and recall to be large.

Image Credit: By Walber – Own work, CC BY-SA 4.0, https://commons.wikimedia.org/w/index.php?curid=36926283

Is there a way to combine Precision and Recall into one measure?
Yes, using F1-Score.

It combines both Precision and Recall values into one value.

F1 – Score = \( \frac{ 2*Pr * Re }{ Pr + Re } \), where Pr = Precision and Re = Recall.
As Value of Pr and Re lie between 0 and 1, F1-Score would also lie between 0 and 1.

We can also rewrite F1-Score as below:

F1-Score = \( \frac{ 2}{ \frac{1}{Pr} + \frac{1}{Re} } \)

In other words, F1-score is the Harmonic mean of Pr and Re.
But here comes another doubt, like why do we use Harmonic mean to calculate F1-Score and why can we just multiply these values to get F1-Score?
And why can’t we use simply mean instead of Harmonic mean or a simple product of them What is the purpose of dividing by Pr + Re?

I have discussed these things in this blog.

Show CommentsClose Comments

Leave a comment