title: NameError: name 'plot_confusion_matrix' is not defined
body: <p>I am trying to make a classification model using VGG16 but at the end of the project I faced an error for getting the <strong>Confusion Matrix</strong>. Below the codes are given,</p>
  <p><strong>Imported packages and modules are:</strong></p>
  <pre><code>import os
  import keras
  import numpy as np
  import tensorflow as tf
  from keras.models import Model
  import matplotlib.pyplot as plt
  from keras.optimizers import Adam
  from keras.applications import MobileNet
  from sklearn.metrics import confusion_matrix
  from keras.layers.core import Dense, Activation
  from keras.metrics import categorical_crossentropy
  from sklearn.model_selection import train_test_split
  from keras.preprocessing.image import ImageDataGenerator
  from keras.applications.mobilenet import preprocess_input
  from tensorflow.keras.preprocessing import image_dataset_from_directory
  </code></pre>
  <p><strong>N.B:</strong> For shorting I just skipping of dataset linked</p>
  <p><strong>Below define VGG16:</strong></p>
  <pre><code>vgg16_model = keras.applications.vgg16.VGG16()
  vgg16_model.summary()
  </code></pre>
  <p><strong>Now, Define the model:</strong></p>
  <pre><code>model = Sequential()
  for layer in vgg16_model.layers:
    model.add(layer)
  
  for layer in model.layers:
    layer.trainable = False
  
  model.add(Dense(2, activation='softmax'))
  </code></pre>
  <p><strong>Compile the model:</strong></p>
  <pre><code>model.compile(Adam(lr=.0001), loss='categorical_crossentropy', metrics=['accuracy'])
  </code></pre>
  <p><strong>Fit the model:</strong></p>
  <pre><code>model.fit_generator(train_batches, steps_per_epoch=4, validation_data=valid_batches, validation_steps=4, epochs=10, verbose=2)
  </code></pre>
  <p><strong>Now for confusion matrix:</strong></p>
  <pre><code>test_imgs, test_labels = next(test_batches)
  plots(test_imgs, titles=test_labels)
  test_labels = test_labels[:,0] 
  predictions = model.predict_generator(test_batches, steps=1, verbose=0)
  cm = confusion_matrix(test_labels, np.round(predictions[:,0]))
  </code></pre>
  <p><strong>Below I faced an error, Please concern below code,</strong></p>
  <pre><code>cm_plot_labels = ['diseaseAffectedEggplant','freshEggplant']
  plot_confusion_matrix(cm, cm_plot_labels, title=&quot;Confusion Matrix&quot;)   // this line, I faced an error
  </code></pre>
  <p><strong>The Error is given below,</strong></p>
  <pre><code>---------------------------------------------------------------------------
  NameError                                 Traceback (most recent call last)
  &lt;ipython-input-28-43b96d543746&gt; in &lt;module&gt;()
        1 cm_plot_labels = ['diseaseAffectedEggplant','freshEggplant']
  ----&gt; 2 plot_confusion_matrix(cm, cm_plot_labels, title=&quot;Confusion Matrix&quot;)
  
  NameError: name 'plot_confusion_matrix' is not defined
  </code></pre>