- Daily Dose of Data Science
- Posts
- Enrich Your Confusion Matrix With A Sankey Diagram
Enrich Your Confusion Matrix With A Sankey Diagram
An unexplored direction of visualising a confusion matrix.
A confusion matrix is mostly interpreted as is, i.e., raw numbers. Sometimes though, it is also visualized by plotting it.

Yet, both these ways are not interactive and truly elegant.
Plotting a confusion matrix as a Sankey diagram is an option worth exploring here.
If you wish to read more about Sankey Diagrams, read my previous post here: Analyse Flow Data With Sankey Diagrams.
As demonstrated below, one can interactively interpret the number of instances belonging to each class and how they were classified.

What's more, hovering over the links gives more info about those instances, which can offer better interpretability.
What do you think? Is this a better approach than the traditional ones? Let me know :)
Find the code for creating the above Confusion Matrix Sankey diagram here: Notebook.
π If you liked this post, donβt forget to leave a like β€οΈ. It helps more people discover this newsletter on Substack and tells me that you appreciate reading these daily insights. The button is located towards the bottom of this email.
π If you love reading this newsletter, feel free to share it with friends!
Find the code for my tips here: GitHub.
Reply