In statistical analysis of binary classification, the Harmonic mean in ML is a measure of a test’s accuracy and is known as F1 score or subcontrary mean.
The F1 score (Harmonic mean) is combined by using the recall and the precision , and is better then taking the arithmetic mean (AM) or the geometric mean (GM) because it penalizes the model better.
Recall (r) is the number of correct positives divided by the number of all actual positives. (TP/TP+FN)
Precision (p) is the number of correct positives divided by the number of all predicted positives. (TP/TP+FP)
The F1 score considers both the p and the r of the test to compute the score between 0 (worst) to 1 (best) – Thus it is a better evaluation tool rather then the basic accuracy which doesn’t account for the needled down, need to know, specifics.
The F1 score can be expressed as the reciprocal (opposite) of the arithmetic mean of the reciprocals of the given set of observations, as can be seen in the beneath formula after it is simplified.