Change language

Learn to calculate by playing with Precision, recall and F1 calculator

A short game to see where the result comes from. Pick a language and start; you can stop halfway and come back.

Loading the game…

← Back to Precision, recall and F1 calculator

What you will practise

Classification metrics from a confusion matrix.

How it works

Precision answers “of what I flagged as positive, how much actually was”; recall answers “of everything that was positive, how much did I catch”. F1 is their harmonic mean and penalises imbalance.

Formula

Precision = TP / (TP + FP)

Recall = TP / (TP + FN)

F1 = 2 · (precision · recall) / (precision + recall)

Accuracy = (TP + TN) / total
Specificity = TN / (TN + FP)

Worked example

TP = 80, FP = 20, FN = 15, TN = 85:

Precision: 80%
Recall: 84.2%
F1: 82.1%
Accuracy: 82.5%

How to play

First pick your language. Then work through the challenges one by one: each sets out a case with real numbers and, if you get stuck, you can ask for a hint. When you answer, you see whether you got it right and why. Progress is saved only in your browser, so you can stop halfway and carry on another day.