title: Binary Keras LSTM model does not output binary predictions
body: <p>I've made a Keras LSTM model that reads in binary target values and is supposed to output binary predictions. However, the predictions aren't binary. A sample of my X and Y values is below:</p>
  
  <pre><code>X      Y
  5.06   0
  4.09   1
  4.72   0
  4.57   0
  4.44   1
  6.98   1 
  </code></pre>
  
  <p>What I'm trying to predict is if Xt+1 is going to be higher or lower than Xt. The Y value for Xt is 1 if Xt+1 is greater than Xt. My training X values are in the shape (932, 100, 1) for 932 samples, 100 for the "look back" sequence, and 1 for the features. The predictions I get look like:</p>
  
  <pre><code>Predictions
  .512
  .514
  .513
  </code></pre>
  
  <p>I'm thinking these might be probabilities as my model accuracy is around 51%. Any ideas as to how to get them to be binary? Full model code is below:</p>
  
  <pre><code># Defining network architecture
  def build_model(layers):
      model = Sequential()
  
      model.add(LSTM(
          input_dim=layers[0],
          output_dim=layers[1],
          return_sequences=True))
      model.add(Dropout(0.2))
  
      model.add(LSTM(
          layers[2],
          return_sequences=False))
      model.add(Dropout(0.2))
  
      model.add(Dense(
          output_dim=layers[3]))
      model.add(Activation("sigmoid"))
  
      start = time.time()
      model.compile(loss="binary_crossentropy", optimizer="rmsprop",metrics=['accuracy'],class_mode="binary")
      print("&gt; Compilation Time : ", time.time() - start)
      return model
  
  # Compiling model
  model = build_model([1, 100, 500, 1])
  </code></pre>