Confusion Matrix for Multiclass Classification

Deriving metrics for multiclass classification from the confusion matrix.

Indhumathy Chelliah
6 min readSep 15, 2022

--

Photo by Olya Kobruseva: https://www.pexels.com/photo/question-marks-on-paper-crafts-beside-coffee-drink-5428834/

The confusion matrix is an n*n matrix that is used to measure the performance of classification models. In this article, we will learn how to use the confusion matrix for multiclass classification. Like what metrics can be derived from the confusion matrix and how to calculate the metrics for each class and how to plot the confusion matrix.

I have covered the below-mentioned questions in this article.

  1. How to plot the confusion matrix?
  2. Which axis contains actual values and which axis contains predicted values?
  3. How to find the order of labels in the confusion matrix?
  4. What metrics can be derived from the confusion matrix?
  5. How to visualize the confusion matrix?
  6. How to find the metrics of one class in a multiclass confusion matrix?
  7. What is a Classification report?
  8. How to calculate the macro average and weighted average scores?

In this tutorial, I have taken the Iris dataset.

1. How to plot the confusion matrix?

--

--