Core idea

A test score is an estimate of performance on a wider population. Its uncertainty depends on the sample, and fair comparisons require attention to how examples and training splits are shared.

1. Estimate performance from a sample

Let , , , and denote true positives, true negatives, false positives, and false negatives. Let be their total. In the F1 formula, is precision and is recall.

MetricFormulaQuestion it answers
AccuracyWhat fraction of predictions are correct?
PrecisionOf the predicted positives, how many are positive?
RecallOf the actual positives, how many were found?
F1How well do precision and recall balance?

For a fixed classifier evaluated on independent, representative test cases, the number correct can be modeled as binomial. If is the observed accuracy, the estimated standard error is . A large-sample approximate 95% interval is . For small samples or estimates close to 0 or 1, use a Wilson or exact binomial interval. A large sample only reduces sampling variability. A biased test set can still give a poor estimate.

Worked check. With , accuracy is , and precision, recall, and F1 are each . Here , giving an approximate accuracy interval of .

When comparing trained classifiers, test them on the same examples and compare their disagreements. McNemar’s test uses the two counts and where only one classifier is correct. With enough discordant cases, is approximately chi-squared with one degree of freedom under equal error rates. To compare learning algorithms, use comparable tuning budgets, common data splits, and repeated evaluations where possible. Report variability alongside the score.

PYQ — CT I 2022, Q2

Original question scan — Class Test I 2022 Q2 on precision, recall, F-score and accuracy

Original question scan — Alternate Class Test I Q2 on sensitivity, specificity, precision and accuracy

Define precision, recall, F-score and accuracy. Precision ; recall ; F1 for precision and recall ; accuracy . State when a denominator is zero rather than silently dividing by zero. Specificity, asked in another CT I paper, is .

2. Sampling and comparison in practice

A hypothesis is fixed before evaluation. If test cases are independently sampled from the target population, its test accuracy estimates the population accuracy. The interval above describes the uncertainty of this estimation procedure; it does not guarantee a biased or shifted test set represents deployment.

For paired comparisons, both classifiers see the same test cases. McNemar’s test counts cases on which A alone is correct () and B alone is correct (); cases where both agree do not distinguish them. The uncorrected statistic is when enough disagreements exist. With few disagreements use an exact binomial test. Repeated cross-validation scores are dependent because training sets overlap, so do not treat all folds as independent experiments.

Accuracy interval

For 90 correct out of 100, and the normal approximation is , or approximately . This is for a fixed classifier and independent, representative observations.