How this calculation works
Choose which class is positive, then count the four actual/predicted outcomes. Calculate accuracy, positive precision, recall, specificity, F1 and Matthews correlation with their separate denominators.
Precision = TP/(TP+FP); recall = TP/(TP+FN); F1 = 2TP/(2TP+FP+FN)A worked example
TP 40, FP 10, FN 5 and TN 45 describe 100 observations. Accuracy is 85%, precision 80%, recall 88.888889% and F1 84.210526%.
Good to know
Whole unweighted binary counts for one fixed decision threshold. At least one observation is required. Undefined metrics stay undefined. No multiclass averaging, ROC analysis, optimal-threshold recommendation, medical advice or fairness conclusion.
Reference: scikit-learn: binary classification evaluation (opens in a new tab) ↗
Choose the positive label before counting outcomes
Imagine a classifier flagging items for manual review. A true positive is a correctly flagged positive item; a false positive is a negative item flagged by mistake. A false negative is a missed positive, while a true negative is a correctly unflagged negative. The table labels actual rows and predicted columns explicitly.
The default counts total 100 observations: 40 true positives, 10 false positives, 5 false negatives and 45 true negatives. Correct decisions total 85. Precision uses the 50 predicted positives as denominator, while recall uses the 45 actual positives. Those are different questions even when they happen to produce similar numbers.
The binomial distribution models a count under supplied assumptions; a confusion matrix summarizes observed decisions against known labels instead.
Accuracy can hide a rare positive class
If only one of 100 items is positive, a classifier predicting negative for every item has 99% accuracy but zero positive recall. With no predicted positives, precision is undefined. Showing that denominator state is more informative than silently labeling it perfect or replacing every undefined metric with zero.
F1 uses 2TP divided by 2TP+FP+FN and is reported here as a percentage. It can be zero even when precision is undefined, provided false negatives or false positives make the direct F1 denominator positive. When all three are zero, F1 is undefined too.
The matrix is one threshold and one evaluation set
Matthews correlation uses all four cells and ranges from −1 to 1 when defined. Any zero marginal total makes its denominator zero. The tool reports that explicitly, rather than implying that every degenerate classification has no association.
The forecast error calculator evaluates numeric predictions instead of class labels. Changing a classifier threshold can change all four counts, but this matrix does not contain the underlying probability scores needed for a ROC curve or threshold search. Keep the dataset, positive-class definition and threshold fixed when comparing reported metrics.
A few questions, answered
Is F1 displayed from zero to one?
Here it is displayed from 0% to 100%. MCC alone uses the −1 to 1 scale.
Can accuracy be defined while precision is undefined?
Yes. Accuracy requires a nonzero overall count; precision additionally requires at least one predicted positive.
Does this evaluate multiple classes?
No. Enter a binary classification or a deliberately defined positive-versus-rest summary, without treating it as automatic multiclass averaging.