title: How do I structure 3D Input properly for Keras LSTM
body: <p>I have a dataset which contains many snapshot observations in time and a 1 or 0 as a label for each observation.  Lets say each observation contains 3 features.  I am wanting to train an LSTM which will take a sequence of n observations and attempt to classify nth observation as a 1 or 0.</p>
  
  <p>So if we have a dataset that looks like this:</p>
  
  <pre><code># X = [[0, 1, 1], [1, 0, 0], [1, 1, 1], [1, 1, 0]]
  # y = [1, 0, 1, 0]
  # so X[0] = y[0], X[1] = y[1]
  # . and I would like to input X[0] + X[1] to classify X[1] as y[1]
  # . How would I need to structure this below?
  
  
  X = [[0, 1, 1], [1, 0, 0], [1, 1, 1], [1, 1, 0]]
  y = [1, 0, 1, 0]
  
  def create_model():
    model = Sequential()
    # input_shape[0] is equal to 2 timesteps?
    # input_shape[1] is equal to the 3 features per row?
    model.add(LSTM(20, input_shape=(2, 3)))
    model.add(Dense(1, activation='sigmoid'))
    model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
    model.summary()
  
  m = create_model()
  m.fit(X, y)
  </code></pre>
  
  <p>So I want <code>X[0]</code> and <code>X[1]</code> to be the input for one iteration of training and should be classified as <code>y[1]</code>.</p>
  
  <p>My question is this.  How do I structure the model in order to take this input properly?  I am very confused by <code>input_shape</code>, <code>features</code>, <code>input_length</code>, <code>batches</code> etc ...</p>