📏  Harmonic Mean

Harmonic Mean#

The reciprocal-based mean underlying the F1 score.

Important

✨ AI-generated content. This page was written with the assistance of an AI language model and is provided as a learning aid. Despite careful review, it may still contain mistakes, omissions, or out-of-date information. Whether you are new to the topic, a team lead, or a senior practitioner, treat it as a starting point rather than an authoritative reference: read it critically and independently verify anything you act on (code, commands, figures, and factual claims) against official documentation and primary sources before relying on it.

What it is#

The harmonic mean is an average that leans toward the smaller of the values — the reciprocal of the average of reciprocals. For two numbers it is:

\[\text{HM} = \frac{2ab}{a + b}.\]

It is always ≤ the arithmetic mean, and equal only when the values match.

Its key property#

It penalizes imbalance. Averaging precision 0.95 and recall 0.20, the arithmetic mean gives a rosy 0.575, but the harmonic mean gives ~0.33 — correctly flagging that one component is poor. A high harmonic mean requires all inputs to be high.

Where it’s used#

That property is exactly why the F1-score uses it to combine precision and recall, and why harmonic means are the right average for rates and ratios (speeds, P/E ratios) rather than additive quantities.


Theme: Classification & Averaging Metrics  ·  All terminology



See also

Source article Adapted (context, re-expressed) in our own words from: Harmonic Mean (insightful-data-lab.com).

Tags: purpose: reference topic: terminology level: intermediate