Graph
Harmonic Mean

➗Harmonic Mean

NEW

An average computed as the reciprocal of the arithmetic mean of reciprocals, especially suitable for averaging rates and ratios.

DESCRIPTION

The harmonic mean is less than the arithmetic mean and emphasizes smaller values, making it appropriate for averaging speeds, densities, or precision-recall into F1 scores. It is the Pythagorean mean complementary to geometric and arithmetic means. In machine learning, it balances precision and recall; in finance or physics, it aggregates rates per unit time or quantity. Care must be taken to avoid zero or negative inputs.

ALTERNATIVE DEFINITIONS

Wikipedia

The harmonic mean is the reciprocal of the arithmetic mean of the reciprocals.

Concise canonical mathematical definition.

Source

Wolfram MathWorld

The harmonic mean of n positive reals x_i is n divided by the sum of reciprocals 1/x_i.

Provides explicit formulaic expression.

Source

Mean Rates F1 Score Weighted Mean

COMPETING TERMS

Arithmetic Mean Geometric Mean

RELATIONS

KNOWLEDGE AREAS

Mathematics Data Science

TARGET AUDIENCE

Data Scientist Data Analyst

EXTERNAL SOURCES

TOP QUESTIONS

When should the Harmonic Mean be used?

Use it to average rates, such as speeds or cost per unit, and to combine precision and recall in the F1 score.

Category: Requirements

How does Harmonic Mean compare to Arithmetic Mean?

It is always less than or equal to the arithmetic mean and weights smaller values more heavily, making it suitable for rate aggregation.

Category: Comparison

Why is Harmonic Mean used in F1 scores?

It penalizes extreme imbalances, ensuring that both precision and recall contribute meaningfully to the combined metric.

Category: Example

Can the Harmonic Mean handle zeros?

No. A zero input makes the harmonic mean undefined because it involves reciprocals. Consider smoothing or exclusion when appropriate.

Category: Risk

Is Harmonic Mean appropriate for averages of prices?

If the data represents rates (price per unit), yes; otherwise, arithmetic mean may be more suitable.

Category: Opinion

What is the formula for Harmonic Mean?

For n positive values x_i, HM = n / Σ(1/x_i).

Category: Definition

What is a misunderstanding about Harmonic Mean?

People often use the arithmetic mean for rates, which can misrepresent true average performance across tasks or intervals.

Category: Misunderstanding

Where is Harmonic Mean used outside ML?

Physics (average speed), finance (average P/E ratios), and engineering (parallel resistances).

Category: Example

How to compute Harmonic Mean in Python?

Use scipy.stats.hmean or implement n / sum(1/x for x in values) with positive values.

Category: HowTo