How to make a confusion matrix
-
Paste your data
Paste cells from a spreadsheet or upload a CSV with a text or number column for Actual class and a text or number column for Predicted class, plus a number column for Count if you have it.
-
Check the columns
The confusion matrix picks its columns for you. Change any of them under Data.
-
Style it and download
Under Style, pick a look, colours, background and size, add a title and source, then download SVG or PNG.
What is a confusion matrix?
A confusion matrix is a grid that counts a classifier's predictions against the true classes, with one row per actual class and one column per predicted class. Correct predictions fall on the diagonal.
How to read it
Colour shows each cell's share of its row, so a dark diagonal means each class is mostly predicted correctly. Bright cells off the diagonal are the mix-ups: read across a row to see where that class's cases went. The row share on the diagonal is recall for that class, and overall accuracy is the diagonal total divided by all cases.
When to use it
See which classes a model gets right and which it mixes up. It is one of the correlation charts, which show how two or more measures move together.
To compare how a model performs across every threshold rather than one, use a ROC curve. If you only need accuracy per class side by side across models, a Grouped column chart is simpler.
Tips for a better confusion matrix
- Supply one row per actual and predicted pair with a count, or one row per case and let the chart do the counting.
- Check the row totals as well as the shares, because a class with very few cases can show a striking percentage from a handful of errors.
- Do not judge an imbalanced problem on accuracy alone: a model that always predicts the majority class can still score high.
Data you need
One row per item with a text or number column for Actual class and a text or number column for Predicted class, plus a number column for Count if you have it. Column names can be anything; the chart maker matches columns by type, and you can change the match under Data.
| Actual | Predicted | Count |
|---|---|---|
| Billing | Billing | 182 |
| Billing | Bug report | 9 |
| Billing | Account | 21 |
| Billing | Feature request | 4 |
| Bug report | Billing | 6 |
| Bug report | Bug report | 241 |
| Bug report | Account | 11 |
| Bug report | Feature request | 27 |
Other charts for the same data
More correlation charts
Questions, answered
- What is a confusion matrix?
- A confusion matrix is a grid that counts a classifier's predictions against the true classes, with one row per actual class and one column per predicted class. Correct predictions fall on the diagonal.
- How do you read a confusion matrix?
- Colour shows each cell's share of its row, so a dark diagonal means each class is mostly predicted correctly. Bright cells off the diagonal are the mix-ups: read across a row to see where that class's cases went. The row share on the diagonal is recall for that class, and overall accuracy is the diagonal total divided by all cases.
- How do I make a confusion matrix?
- Paste your data into the chart maker with a text or number column for Actual class and a text or number column for Predicted class, plus a number column for Count if you have it. The confusion matrix draws as you type. Then pick a look and a size and download it as SVG or PNG.
- When should I use a confusion matrix?
- See which classes a model gets right and which it mixes up. It belongs to the correlation family of charts, which show how two or more measures move together. To compare how a model performs across every threshold rather than one, use a ROC curve. If you only need accuracy per class side by side across models, a Grouped column chart is simpler.
- Is this confusion matrix maker free?
- Yes. It is free with no sign-up, your data stays in your browser, and you can download the confusion matrix as SVG or PNG.