title: Keras Sequential Model Data Preparation: observations of single row
body: <p>My data is a matrix of 400k observations, where each observation is a single row of data, 200 elements in length. My output data is 400k 1-hot vectors corresponding to 11 output classes. I would like to format my data for a keras sequential model. (Keras 2.0.4, Python 3)</p>
  
  <pre><code>train_values.shape
  &gt;&gt;&gt; (400000, 200)
  
  data_labels.shape
  &gt;&gt;&gt; (400000, 11)
  </code></pre>
  
  <p>Attempt 1:</p>
  
  <pre><code>model = Sequential()
  model.add(LSTM(100, input_shape = (200,), return_sequences=True))
  model.add(Dense(output_dim=11, input_dim=100, activation='softmax'))
  model.compile(loss='categorical_crossentropy',optimizer='rmsprop',metrics=['accuracy'])
  model.fit(train_values, train_labels, batch_size=200, epochs=10)
  score = model.evaluate(test_values, test_labels, batch_size=200)
  </code></pre>
  
  <p>Error 1:</p>
  
  <pre><code>    ----&gt; 3 model.add(LSTM(100, input_shape = (200,), return_sequences=True))
  
  ValueError: Input 0 is incompatible with layer lstm_1: expected ndim=3, found ndim=2
  </code></pre>
  
  <p>Attempt 2:</p>
  
  <pre><code>model = Sequential()
  model.add(Embedding(400000,200))
  model.add(LSTM(100, input_shape = (200,), return_sequences=True))
  model.add(Dense(output_dim=11, input_dim=100, activation='softmax'))
  model.compile(loss='categorical_crossentropy',optimizer='rmsprop',metrics=['accuracy'])
  model.fit(train_values, train_labels, batch_size=200, epochs=10)
  score = model.evaluate(test_values, test_labels, batch_size=200)
  </code></pre>
  
  <p>Error 2:</p>
  
  <pre><code>----&gt; 7 model.fit(train_values, train_labels, batch_size=200, epochs=10)
  ValueError: Error when checking target: expected dense_1 to have 3 dimensions, but got array with shape (400000, 11)
  </code></pre>
  
  <p>Conclusion: Is my error with the input formatting, the calling of my layers, or something else entirely that I'm unaware of?</p>