title: Getting ValueError while fitting ANN
body: <p>I am trying to fit ANN on Kaggle's Titanic dataset but getting ValueError. When I used RandomForest, there was no problem and when I am trying to use Artificial Neural Network, the code is throwing below error. Can you point out why I am getting the below error. I have pasted the code below</p>
  
  <pre><code>    import numpy as np
      import pandas as pd
      train_data = pd.read_csv("/kaggle/input/titanic/train.csv")
      test_data = pd.read_csv("/kaggle/input/titanic/test.csv")
      y = train_data["Survived"]
      y = np.array(y.values.tolist())
  
  
      features = ["Pclass", "Sex", "SibSp", "Parch", "Age", "Fare"]
      X = pd.get_dummies(train_data[features])
      X_test = pd.get_dummies(test_data[features])
  
      from sklearn.impute import SimpleImputer
      my_imputer = SimpleImputer()
      X = my_imputer.fit_transform(X)
      my_imputer = SimpleImputer()
      X_test = my_imputer.fit_transform(X_test)
  
      from sklearn.preprocessing import StandardScaler
      sc= StandardScaler()
      X=sc.fit_transform(X)
      X_test=sc.transform(X_test)
  
      import keras
      from keras.models import Sequential
      from keras.layers import Dense
      classifier = Sequential()
      classifier.add(Dense(units=4, kernel_initializer='uniform', activation= 'relu', input_dim=6))
      classifier.add(Dense(units=4, kernel_initializer='uniform', activation='relu'))
      classifier.add(Dense(units=1, kernel_initializer='uniform', activation='sigmoid'))
      classifier.compile(optimizer = 'adam', loss='binary_crossentropy', metrics=['accuracy'])
      #Fitting the ANN to the Training set
      classifier.fit(X, y, batch_size=10, epochs=100)
  </code></pre>
  
  <p>Error as below</p>
  
  <pre><code>    ---------------------------------------------------------------------------
      ValueError                                Traceback (most recent call last)
      &lt;ipython-input-30-f7e7c8ad52f1&gt; in &lt;module&gt;
      ----&gt; 1 classifier.fit(X, y, batch_size=10, epochs=100)
  
      /opt/conda/lib/python3.7/site-packages/keras/engine/training.py in fit(self, x, y, batch_size, epochs,     verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight,     initial_epoch, steps_per_epoch, validation_steps, validation_freq, max_queue_size, workers,         use_multiprocessing, **kwargs)
         1152             sample_weight=sample_weight,
         1153             class_weight=class_weight,
      -&gt; 1154             batch_size=batch_size)
         1155 
         1156         # Prepare validation data.
  
      /opt/conda/lib/python3.7/site-packages/keras/engine/training.py in _standardize_user_data(self, x, y,     sample_weight, class_weight, check_array_lengths, batch_size)
          577             feed_input_shapes,
          578             check_batch_axis=False,  # Don't enforce the batch size.
      --&gt; 579             exception_prefix='input')
          580 
          581         if y is not None:
  
      /opt/conda/lib/python3.7/site-packages/keras/engine/training_utils.py in standardize_input_data(data,     names, shapes, check_batch_axis, exception_prefix)
          143                             ': expected ' + names[i] + ' to have shape ' +
          144                             str(shape) + ' but got array with shape ' +
      --&gt; 145                             str(data_shape))
          146     return data
          147 
  
      ValueError: Error when checking input: expected dense_11_input to have shape (6,) but got array with         shape (7,)
  </code></pre>
  
  <p>I tried converting y variable to array but it still giving the same error. </p>