title: Python Keras - Large MSE
body: <p>I am new to KerasRegressor. I am trying to run neural net following this codes:</p>
  <pre><code>import tensorflow as tf
  import numpy as np
  from sklearn import datasets, linear_model
  from sklearn.model_selection import cross_val_score, KFold
  from keras.models import Sequential
  from sklearn.metrics import accuracy_score
  from keras.layers import Dense
  from keras.wrappers.scikit_learn import KerasRegressor
  seed = 1
  
  
  def baseline_model():
      model = Sequential()
      model.add(Dense(10, input_dim=10, activation='relu'))
      model.add(Dense(1))
      model.compile(loss='mean_squared_error', optimizer='adam')
      return model
  
  
  estimator = KerasRegressor(build_fn=baseline_model, nb_epoch=100, batch_size=100, verbose=False)
  kfold = KFold(n_splits=10, random_state=seed)
  results = cross_val_score(estimator, X_train,y_train, cv=kfold)
  print(&quot;Results: %.2f (%.2f) MSE&quot; % (results.mean(), results.std()))
  
  estimator.fit(X_train, y_train)
  prediction = estimator.predict(X_test)
  </code></pre>
  <p>Then I stumbled the following errors:</p>
  <pre><code>ValueError: Input 0 of layer sequential_45 is incompatible with the layer: expected axis -1 of input shape to have value 10 but received input with shape [None, 39]
  </code></pre>
  <p>UPDATE: I fixed the error, it was in input_dim, which should be change to X_train.shape[-1]. However, I have a very large error, even after I try normalized X_train:</p>
  <pre><code>Results: -1674844.52 (3109620.06) MSE
  </code></pre>
  <p>I wonder how I should solve this? Thanks!</p>