Read a multiclass confusion matrix before changing a ticket router
Sources checked 2 min read · By the Eval Suites editors
In brief
A multiclass confusion matrix counts where each reviewed case was sent. Read across the actual class’s row to find where its cases went and down the predicted class’s column to see what landed in that queue. Compare counts on the same cases before deciding which version to release.
Keep the actual queues on the rows
Use one reviewed destination and one prediction per ticket. Keep the same class order and ticket IDs for the baseline and candidate. In scikit-learn’s confusion_matrix, each row is an actual class and each column is a predicted class. Pass the full label set to keep queues visible when a version sends them zero tickets.[1]
Store the case IDs alongside the matrix. A count tells you where to investigate. The labeled message and model output tell you whether to change the prompt, queue policy or reference label.
Compare the Oak Workshop routers
The fictional Oak Workshop routes 12 labeled tickets to Orders, Repairs or Cancellations. In ticket order O1–O6, R1–R4, C1–C2, the baseline predictions are O O O O O R, O R R R, O R. The candidate predicts O O O O R R, O R R C, C C. The letters stand for the three queues.
| Actual queue | Predicted Orders | Predicted Repairs | Predicted Cancellations |
|---|---|---|---|
| Orders (6) | 5 | 1 | 0 |
| Repairs (4) | 1 | 3 | 0 |
| Cancellations (2) | 1 | 1 | 0 |
| Actual queue | Predicted Orders | Predicted Repairs | Predicted Cancellations |
|---|---|---|---|
| Orders (6) | 4 | 2 | 0 |
| Repairs (4) | 1 | 2 | 1 |
| Cancellations (2) | 0 | 0 | 2 |
Both versions route 8 of 12 correctly. Cancellation recall rises from 0/2 to 2/2. Cancellation precision is undefined for the baseline because it predicts zero cancellations. For the candidate it is 2/3 because R4, a repair ticket, joins the two real cancellations in that queue. scikit-learn’s classification_report lets you choose how to represent undefined metrics. Keep the zero-prediction count beside that display choice.[2]
Inspect the tickets that changed queue
The candidate recovers C1 and C2 and introduces two misroutes on O5 and R4. If missing a cancellation has a high downstream cost, the two recovered tickets justify checking additional cancellation examples. If the cancellation queue triggers work automatically, inspect R4 and keep automated handoff gated until you can measure false referrals on more cases.
Keep raw counts with percentages so reviewers can see that 100% cancellation recall comes from two examples. Row normalization shows the destination distribution for each actual class. Column normalization shows the mix of actual classes in each predicted queue.[1]
If requests can legitimately have two destinations, resolve how the router should represent that case before forcing a single label. If the application allows an explicit human-review outcome, report it separately and measure how many requests reach it. Choose an abstention threshold that fits the review queue.
Related suites
Related reading
Sources
- 1. scikit-learn confusion_matrix reference · scikit-learn · Official docs · Sources checked
- 2. scikit-learn classification_report reference · scikit-learn · Official docs · Sources checked