Confusion Matrix Explorer
Paste predictions or type four counts, and get the matrix with every metric derived from it — each one defined next to its value.
15 of 20 correct. In a single-label problem, micro-averaged precision, recall and F1 are all equal to this number — which is why quoting "micro-F1" adds nothing over quoting accuracy.
| actual ↓ / predicted → | account | billing | technical |
|---|---|---|---|
| account | 4 | 1 | 0 |
| billing | 0 | 6 | 2 |
| technical | 1 | 1 | 5 |
Rows are the truth, columns are the prediction. Everything off the diagonal is an error, coloured so the dominant confusion is visible at a glance.
| class | precision | recall | F1 | support |
|---|---|---|---|---|
| account | 0.800 | 0.800 | 0.800 | 5 |
| billing | 0.750 | 0.750 | 0.750 | 8 |
| technical | 0.714 | 0.714 | 0.714 | 7 |
| macro average | 0.755 | 0.755 | 0.755 | 20 |
| support-weighted | — | — | 0.750 | 20 |
- Precision — of what you flagged, how much was right (TP / (TP+FP))
- 0.755
- Recall — of what was there, how much you found (TP / (TP+FN))
- 0.755
- F1 — the harmonic mean of those two, which punishes the weaker one
- 0.755
- Macro average — every class counts the same, however rare
- 0.755
- Support-weighted average — every example counts the same
- 0.750
Billing and billing are two classes — that is deliberate, since silently merging them would hide a real bug in your pipeline. A class that was never predicted has undefined precision; it is shown as "—" and counted as 0 in the macro average, which is what scikit-learn does with zero_division=0.Everything on this page runs in your browser. Nothing you paste is uploaded, logged, or put in the URL — only the settings above the input are, so a configured tool can be linked to.
Which average you quote changes the story
Macro-F1 gives every class equal weight, so a class with nine examples moves it as much as a class with nine thousand. Support-weighted F1 gives every example equal weight, so the rare classes disappear. Both are correct; they answer different questions. If the rare class is the expensive one — fraud, self-harm, a safety refusal — quote macro, and expect it to be much lower than the number your dashboard shows.
Where accuracy actively misleads
On a 99:1 split, a classifier that returns "negative" unconditionally scores 99% accuracy, a perfect specificity and a recall of zero. This is not a hypothetical — it is the default failure of every under-trained moderation model and every LLM prompt that has learned the safest answer is "no". MCC is the number that catches it: it uses all four cells of the matrix and collapses toward zero for a classifier that is not doing better than chance, whatever the class balance.
One more habit worth keeping: read the matrix before the metrics. A single dominant off-diagonal cell means two classes your model cannot tell apart, and merging them, or rewriting their definitions, usually beats any amount of tuning. A row of errors spread evenly means something else — probably that the class is not learnable from the features you have.