title: Passing input_dim to KerasClassifier (sklearn wrapper/interface)
body: <p>I originally tried the same approach and ran into the same error as <a href="https://stackoverflow.com/questions/40393629/how-to-pass-a-parameter-to-scikit-learn-keras-model-function">this SO questioner</a>. However, using the accepted (and only) answer there gave me another error: "input_dim is not a legal parameter."</p>
  
  <p>I then tried to use the solution ("add an input_dim keyarg to the KerasClassifier constructor") on the original question, and got the same error again. Am I doing something wrong, or is there a new way to pass a first layer's input_dim through the sklearn wrapper KerasClassifier now?</p>
  
  <p>Minimal code example below:</p>
  
  <pre><code>from keras.models import Sequential
  from keras.layers import Dense
  from sklearn import datasets
  from keras.wrappers.scikit_learn import KerasClassifier
  import numpy as np
  
  
  def create_model():
      # create model
      model = Sequential()
      model.add(Dense(12, input_dim=4, init='uniform', activation='relu'))
      model.add(Dense(6, init='uniform', activation='relu'))
      model.add(Dense(1, init='uniform', activation='sigmoid'))
  
      # Compile model
      model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
  
      return model
  
  #Error thrown here:
  model = KerasClassifier(build_fn=create_model, input_dim=5, nb_epoch=150, batch_size=10, verbose=0)
  </code></pre>
  
  <blockquote>
    <p>ValueError: input_dim is not a legal parameter</p>
  </blockquote>