Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Machine Learning by (19k points)

When we calculate the F-Measure considering both Precision and Recall, we take the harmonic mean of the two measures instead of simple arithmetic mean.

What is the intuitive reason behind taking the harmonic mean and not a simple average?

1 Answer

0 votes
by (33.1k points)

I want to explain harmonic mean with the help of a example. 

Suppose you covered a particular distance at 30kmph and 40kmph for one hour each. Then 35kmph is the arithmetic average/mean of speed. But if you drive for 10 files at 30kmph and 40kmph, then the harmonic mean will be 34.3mph.

 

In the same way, Precision and recall both have true positives in the numerator and different denominators. If you average their reciprocals, then the harmonic mean will help. 

In simple terms, harmonic mean decomposes extreme values more.

If you consider a trivial method (e.g. always returning class A). There are many data elements of class B and a single element of class A:

Precision: 0.0

Recall:    1.0

When taking the arithmetic mean, it would have 50% correct. Despite being the worst possible outcome. With the harmonic mean, the F1-measure is 0.

Arithmetic mean: 0.5

Harmonic mean:   0.0

In other words, to have a high F1, you need to both have high precision and recall.

Hope this answer helps.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...