Harmonic Mean
noun
say it: “har-MON-ik MEEN” /hɑrˈmɑnɪk ˈmin/
A kind of average found by dividing the count of numbers by the sum of their reciprocals; it stays close to the smallest values.
What is the harmonic mean?
The harmonic mean is an average that leans toward the smaller of its numbers: for two numbers it's 2 × a × b / (a
- b). The harmonic mean of 1.0 and 0.2 is 0.33, where the ordinary mean is 0.6, which is why the F1 score uses it.
from statistics import harmonic_mean
print(round(harmonic_mean([1.0, 0.2]), 2)) # 0.33
print((1.0 + 0.2) / 2) # 0.6: the ordinary mean
In a sentence
- “The harmonic mean of perfect precision and a recall of 0.2 is only 0.33.”
- “F1 is the harmonic mean of precision and recall.”
Level: Journeyman · More AI Basics terms at this level
Updated