What is Harmonic Mean?
Harmonic mean is a type of average generally used for numbers that represent a rate or ratio such as the precision and the recall in information retrieval. The harmonic mean can be described as the reciprocal of the arithmetic mean of the reciprocals of the data. This can be expressed mathematically as
H is the harmonic mean, n is the number of data points in the set, is the nth value in the data set. The harmonic mean is the smaller of the three Pythagorean means and tends to emphasize the impact of small outliers while minimizing the impact of large outliers. When dealing with rates, the harmonic mean is considered to be the true average compared to the arithmetic average and this can easily be proven by calculating average speed. Assume a vehicle travels 10 miles at 60 mph (this would take 10 minutes) and then travels another 10 miles at 30 mph (this would take 20 minutes). So, 20 miles were traveled in 30 minutes which means the vehicle’s average speed should be 40 mph. Now, let’s compare this average speed to the arithmetic mean of the two speeds
The arithmetic mean results in a noticeably higher speed. 20 miles at 45 mph would take 26.67 minutes; not a match. Now, let’s try the harmonic mean of the two speeds
Why is this Useful?
The harmonic mean is used in machine learning to calculate something called an F-score or F-measure. The F-score is a test for evaluating the performance of algorithms in information retrieval.