title: Confusion Matrix - ValueError: Found input variables with inconsistent numbers of samples
body: <p>For the sake of reproducibility, the training and validations datasets I am using are <a href="https://drive.google.com/drive/folders/1-_dvey1kwLJoqfIdf4nxfkvWAqE1gL81?usp=sharing" rel="nofollow noreferrer">shared here</a></p>
  <p>The <code>validation_dataset.csv</code> is the ground truth of <code>training_dataset.csv</code>.</p>
  <p>What I am doing below is feeding the datasets into a simple CNN layer that extracts the useful features of the images and feed that as 1D into the LSTM network for classification.</p>
  <pre class="lang-py prettyprint-override"><code>
  from keras.models import Sequential
  from keras.layers import Dense, Flatten, Activation
  from keras.layers.convolutional import Conv1D
  from keras.layers import LSTM
  from keras.layers.convolutional import MaxPooling1D
  from keras.layers import TimeDistributed
  from keras.layers import Dropout
  from keras import optimizers
  from keras.callbacks import EarlyStopping
  import pandas as pd
  from sklearn.model_selection import train_test_split
  import matplotlib.pyplot as plt
  from sklearn.metrics import confusion_matrix, classification_report, accuracy_score
  from confusion_matrix import plot_confusion_matrix
  import scikitplot as skplt
  from numpy import genfromtxt
  
  train_set = genfromtxt('data/train/training_dataset.csv', delimiter=',') 
  validation_set = genfromtxt('data/validation/validation_dataset.csv', delimiter=',') 
  
  
  train_set = train_set[..., None] 
  validation_set = validation_set[..., None]
  
  
  X_train, X_test, y_train, y_test = train_test_split(train_set, validation_set, test_size=0.30, random_state=0)
  
  
  
  
  
      
  batch_size=16
  epochs=5
  
  # Create the model
      
  model = Sequential()
  
  model.add(Conv1D(filters=5, kernel_size=3, activation='relu', padding='same'))
  model.add(MaxPooling1D(pool_size=2))
  model.add(LSTM(50, return_sequences=True))
  model.add(Dropout(0.5))
  model.add(LSTM(10))
  
  model.add(Dense(1,kernel_initializer='random_normal'))
  model.add(Activation('relu'))
  
  adam = optimizers.Adam(lr=0.001, beta_1=0.9, beta_2=0.999, epsilon=None, decay=0.0)
  sgd = optimizers.SGD(lr=0.1, decay=1e-6, momentum=0.9, nesterov=True)
  
  model.compile(optimizer=adam, loss='mean_squared_error', metrics=['mae', 'mape', 'mean_squared_error', 'acc'])
  
  
  
  model.fit(X_train, y_train, batch_size=batch_size, epochs=epochs)
  
  
  
  print(model.summary())
  
  
  # Evaluate the model
  scores = model.evaluate(X_test, y_test, verbose=0)
  print(&quot;Accuracy: %.2f%%&quot; % (scores[1]*100))
  
  skplt.metrics.plot_confusion_matrix(y_test, scores, x_tick_rotation=50, title=' ', normalize=True)
  </code></pre>
  <p>Finally, I want to plot the confusion matrix of the model using</p>
  <p><code>skplt.metrics.plot_confusion_matrix(y_test, scores, x_tick_rotation=50, title=' ', normalize=True)</code></p>
  <p>However, it is raising an error <code>ValueError: Found input variables with inconsistent numbers of samples: [5394, 5]</code>.</p>
  <p>How can we fix this error?</p>