Média Harmônica
Calcula n / Σ(1/xᵢ). Útil para taxas e velocidades médias.
HM
—
Harmonic mean: the right average for rates with a fixed numerator
For n positive values, the harmonic mean is HM = n / Σ(1/xᵢ). Flip the values, average those reciprocals, then flip back. The inequality of means puts it last in line: AM ≥ GM ≥ HM, and the three only meet when every value is equal. Where it really earns its keep is rates whose numerator is fixed, the classic case being average speed over the same distance. Drive 60 km at 60 km/h and then 60 km at 30 km/h and your average speed is 2/(1/60 + 1/30) = 40 km/h, not the tempting 45. Machine learning leans on the same idea: the F1-score is the harmonic mean of precision and recall, so the weaker of the two drags the score down hard.
Applications
Think average speed across legs of equal distance, the F1-score in classifiers that balances precision and recall, the harmonic P/E ratio used when aggregating an index so high-multiple companies don't dominate, parallel electrical resistance, and the average-income paradox that crops up when you aggregate per-capita ratios.
FAQ
When use HM instead of arithmetic mean? Any time you're averaging rates that share a fixed numerator, like km over the same distance or items over the same workload. Lean on the arithmetic mean there and you'll end up with too high a number.
Why is F1 the harmonic mean of precision and recall? Because the smaller value calls the shots. A model with precision 1.0 and recall 0.1 lands at F1 ≈ 0.18, far below the 0.55 the arithmetic mean would report, and that gap is exactly what puts the weak side on display.
Does it work with zeros? No. A zero leaves 1/x undefined, and the HM either collapses to zero or stops being defined at all. Stick to strictly positive values.
Related Tools
Rent Adjustment Calculator
Compute annual rent adjustment by IGP-M or IPCA accumulated in the last 12 months (manually configurable).
Pregnancy Calculator
Compute estimated due date (EDD), gestational age and trimester from the last menstrual period (LMP).
Fertile Period Calculator
Compute fertile window and ovulation day from the first day of the last cycle and the average cycle length.