Calculate F1 from counts

Type each count alongside the label that gives it meaning. · 161 words

An archive search labels twelve photographs as showing a bridge. A curator confirms that eight of the twelve really show bridges. Four genuine bridge photographs were missed as well. The eight confirmed items are true positives, the four incorrect suggestions are false positives, and the four missed items are false negatives. The F1 score combines precision and recall. Using counts, put twice the true positives in the numerator and add both kinds of errors to that doubled count in the denominator.

For these results the numerator is sixteen and the denominator is twenty-four, giving two thirds. A photograph that was correctly left out of the bridge results does not enter that calculation. If the archive contained thousands of such photographs, a raw accuracy percentage might still look excellent while a visitor missed a third of the relevant pictures. Use the measured score together with the counts. They show the curator that both unwanted suggestions and missing photographs contributed to the result.

Check your recall

What F1 score follows from eight true positives, four false positives and four false negatives?

Check your answer

Twice eight divided by sixteen plus four plus four equals sixteen over twenty-four, or two thirds.

Sources and credits

Original KeyTouch lesson. Background reading · Google · Classification metrics.