title: TensorFlow fit gives TypeError: Cannot clone object error
body: <p>I am using a basic CNN model to classify my data. The dimensions of my input data is (325, 20, 244,244). The code that i have used is as follows:</p>
  
  <pre><code>model = Sequential()
  model.add(Dense(2, activation='relu', input_shape=X_train.shape[1:]))
  model.add(Dense(2, activation='sigmoid'))
  
  optimizer = ['SGD', 'RMSprop', 'Adagrad', 'Adadelta', 'Adam', 'Adamax', 'Nadam']
  epochs = [10, 50, 100]
  param_grid = dict(epochs=epochs, optimizer=optimizer)
  
  model.compile(loss='binary_crossentropy', metrics=['accuracy'])
  grid = GridSearchCV(estimator=model, param_grid=param_grid, scoring='accuracy', n_jobs=-1, refit='boolean')
  grid_result = grid.fit(X_train, Y_train, validation_data=(X_test, Y_test))
  print("Best: %f using %s" % (grid_result.best_score_, grid_result.best_params_))
  </code></pre>
  
  <p>The output I got is:</p>
  
  <pre><code>grid_result = grid.fit(X_train, Y_train, validation_data=(X_test, Y_test))
  
  Traceback (most recent call last):
  
    File "&lt;ipython-input-16-bb553189f3ee&gt;", line 1, in &lt;module&gt;
      grid_result = grid.fit(X_train, Y_train, validation_data=(X_test, Y_test))
  
    File "C:\Users\Student\Anaconda3\lib\site-packages\sklearn\model_selection\_search.py", line 633, in fit
      base_estimator = clone(self.estimator)
  
    File "C:\Users\Student\Anaconda3\lib\site-packages\sklearn\base.py", line 60, in clone
      % (repr(estimator), type(estimator)))
  
  TypeError: Cannot clone object '&lt;tensorflow.python.keras.engine.sequential.Sequential object at 0x0000025993610B08&gt;' (type &lt;class 'tensorflow.python.keras.engine.sequential.Sequential'&gt;): it does not seem to be a scikit-learn estimator as it does not implement a 'get_params' methods.
  </code></pre>
  
  <p>Can anyone please tell me what is wrong with the code and how it can be corrected.</p>