StatGardenREF. DESK
Calculators/Statistics/Confusion matrix
Statistics

Confusion matrix calculator

Turns the four counts of a binary confusion matrix into accuracy, precision, recall and F1.

What this calculator does

Confusion matrix works out turns the four counts of a binary confusion matrix into accuracy, precision, recall and F1. Enter your own figures above and the answer updates as you type: nothing is fixed in the code, so the result reflects exactly the numbers you supply.

The formula this calculator evaluates is printed under the tool and explained below, so you can check the working by hand or reuse it in a spreadsheet.

The formula

FormulaAccuracy=(TP+TN)/total, Precision=TP/(TP+FP), Recall=TP/(TP+FN), F1=2·Precision·Recall/(Precision+Recall), Specificity=TN/(TN+FP)

The inputs explained

FieldWhat to enter
True positivesA number. Starts at 50.
False positivesA number. Starts at 10.
False negativesA number. Starts at 5.
True negativesA number. Starts at 85.

Worked examples

Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.

How the answer changes with true positives

Every other input is held at the calculator’s starting values while true positives varies. Select any row to load that scenario into the calculator.

How the answer changes with true positives
True positivesAccuracyPrecisionRecall (sensitivity)
2588.0%71.4%83.3%
37.589.1%78.9%88.2%
5090.0%83.3%90.9%
7591.4%88.2%93.8%
10092.5%90.9%95.2%
15094.0%93.8%96.8%