Skip to content

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.

Accuracy
75.0%

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 →accountbillingtechnical
account410
billing062
technical115

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.

classprecisionrecallF1support
account0.8000.8000.8005
billing0.7500.7500.7508
technical0.7140.7140.7147
macro average0.7550.7550.75520
support-weighted0.75020
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
Every line parsed, and every class has both true examples and predictions.
What this checked: this builds the full confusion matrix from your labels and computes per-class precision, recall, F1 and support, macro and support-weighted averages, accuracy, and — for two classes — specificity, balanced accuracy, MCC and prevalence. Each is defined next to its value. It checks that every line has two fields and names the line that does not. It does not check that your labels are correct, that the sample is representative, or that the classes mean what you think; and it computes no confidence intervals, so two runs differing by a point are not distinguishable here.
What this assumes: single-label classification: each example has exactly one true class and one predicted class. Label matching is exact and case-sensitive, so 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.

Confusion Matrix Explorer · Multigrid