Metrics from a confusion matrix

Problem

A classifier has TP=18\mathrm{TP}=18, FP=6\mathrm{FP}=6, FN=2\mathrm{FN}=2, and TN=24\mathrm{TN}=24. Compute accuracy, precision, recall, specificity, and F1F_1 for the positive class.

Reveal answer or reference solution

There are 5050 examples. The metrics are

accuracy=18+2450=0.84,precision=1824=0.75,recall=1820=0.90,specificity=2430=0.80.\begin{aligned} \text{accuracy} &= \frac{18+24}{50}=0.84,\\ \text{precision} &= \frac{18}{24}=0.75,\\ \text{recall} &= \frac{18}{20}=0.90,\\ \text{specificity} &= \frac{24}{30}=0.80. \end{aligned}

Finally,

F1=2 TP2 TP+FP+FN=3644=911≈0.8181818.F_1=\frac{2\,\mathrm{TP}}{2\,\mathrm{TP}+\mathrm{FP}+\mathrm{FN}}=\frac{36}{44}=\frac{9}{11}\approx 0.8181818.
Outcome

Previous attempts

Loading attempts saved in this browser…

    Review Screening Results