title: Why I'm getting bad result with Keras vs random forest or knn?
body: <p>I'm learning deep learning with <code>keras</code> and trying to compare the results (accuracy) with machine learning algorithms (<code>sklearn</code>) (i.e <code>random forest</code>, <code>k_neighbors</code>)</p>
  
  <p>It seems that with <code>keras</code> I'm getting the worst results.
  I'm working on simple classification problem: <code>iris dataset</code>
  My keras code looks:</p>
  
  <pre><code>samples = datasets.load_iris()
  X = samples.data
  y = samples.target
  df = pd.DataFrame(data=X)
  df.columns = samples.feature_names
  df['Target'] = y
  
  # prepare data
  X = df[df.columns[:-1]]
  y = df[df.columns[-1]]
  
  # hot encoding
  encoder = LabelEncoder()
  y1 = encoder.fit_transform(y)
  y = pd.get_dummies(y1).values
  
  # split
  X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.3)
  
  # build model
  model = Sequential()
  model.add(Dense(1000, activation='tanh', input_shape = ((df.shape[1]-1),)))
  model.add(Dense(500, activation='tanh'))
  model.add(Dense(250, activation='tanh'))
  model.add(Dense(125, activation='tanh'))
  model.add(Dense(64, activation='tanh'))
  model.add(Dense(32, activation='tanh'))
  model.add(Dense(9, activation='tanh'))
  model.add(Dense(y.shape[1], activation='softmax'))
  model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])
  model.fit(X_train, y_train)
  score, acc = model.evaluate(X_test, y_test, verbose=0)
  
  #results:
  #score = 0.77
  #acc = 0.711
  </code></pre>
  
  <p>I have tired to add layers and/or change number of units per layer and/or change the activation function (to <code>relu</code>) by it seems that the result are not higher than 0.85.</p>
  
  <p>With sklearn <code>random forest</code> or <code>k_neighbors</code> I'm getting result (on same dataset) above 0.95.</p>
  
  <ol>
  <li><p>What am I missing ?</p></li>
  <li><p>With <code>sklearn</code> I did little effort and got good results, and with <code>keras</code>, I had a lot of upgrades but not as good as <code>sklearn</code> results. why is that ?</p></li>
  <li><p>How can I get same results with <code>keras</code> ?</p></li>
  </ol>