title: What is the meaning of confusion matrix that I got using 5 classes for the classification?
body: <p>I have been working on a classification problem. As a newbie in Machine Learning, I just came across Confusion Matrix, I put the data and arguments as mentioned in their documentation. But I am confused that what really is the meaning of it. </p>
  
  <p>P.S. I am working on classification problem having 5 classes to predict images.</p>
  
  <p>I use the code below. The images of the output is also given below.</p>
  
  <pre class="lang-py prettyprint-override"><code># Confusion Matrix
  from sklearn.metrics import confusion_matrix
  cm = confusion_matrix(tr_int,prediction)
  </code></pre>
  
  <p>You can check the heat map here -> <a href="https://imgur.com/6zuzvkg" rel="nofollow noreferrer">Heatmap</a>.
  And the image of confusion matrix array here-> <a href="https://imgur.com/8tZZUtX" rel="nofollow noreferrer">ConfusionMatrix</a>
  The code I'm using for plotting is given below.</p>
  
  <pre class="lang-py prettyprint-override"><code>import itertools
  def plot_con(cm,classes,normalize=False,title="Confusion Matrix", cmap = plt.cm.Blues):
      plt.imshow(cm,interpolation='nearest', cmap=cmap)
      plt.title(title)
      plt.colorbar()
      tick_marks = np.arange(len(classes))
      plt.xticks(tick_marks, classes, rotation = 45)
      plt.yticks(tick_marks,classes)
  
      if normalize: 
          cm = cm.astype('float')/ cm.sum(axis = 1)[:, np.newaxis]
          print("Normalized C Matrix")
      else:
          print("Without Normalization")
  
      print(cm)
  
      thresh = cm.max() / 2.
      for i, j in itertools.product(range(cm.shape[0]),range(cm.shape[1])):
          plt.text(j, i, cm[i,j],
                  horizontalalignment = "center"
                  color = "white" if cm[i,j] &gt; thresh else "black")
  
      plt.tight_layout()
      plt.ylabel('True Label')
      plt.xlabel('Predicted')
  </code></pre>
  
  <p>Thanks.</p>