InfyCalculator
📊

F1 Score Calculator (Precision, Recall, Fβ)

From a confusion matrix get precision, recall, F1, F0.5, F2, accuracy, specificity and balanced accuracy for a classifier or a test.

True positives
False positives
False negatives
True negatives
β for Fβ (recall weight)
Loading calculator…

How it works

precision = TP/(TP+FP); recall = TP/(TP+FN); Fβ = (1+β²)·P·R ÷ (β²·P + R); F1 is β = 1

Accuracy misleads on imbalanced data — predicting “negative” for everyone scores 90% when positives are 10% of cases. The F1 score is the harmonic mean of precision and recall, so it is high only when both are. Fβ lets you weight recall β times as much as precision: F2 for screening tests where a miss is costly, F0.5 when false alarms are the expensive error.

Worked example

TP 80, FP 20, FN 30, TN 870: precision 80%, recall 72.7%, F1 = 0.762, F2 = 0.741; accuracy is a flattering 95%.

Frequently asked questions

Why the harmonic mean?

It punishes imbalance: precision 100% with recall 10% gives F1 = 0.18, not the 0.55 an arithmetic mean would suggest.

Macro vs micro F1?

For multi-class problems compute F1 per class and average (macro) or pool all counts first (micro, which equals accuracy).

Related calculators

This calculator is for educational purposes. Double-check important results before acting on them.