title: Keras Error:The model cannot be compiled because it has no loss to optimize
body: <p>When I was using Keras. I received a wired error:</p>
  
  <p><strong>ValueError: The model cannot be compiled because it has no loss to optimize.</strong></p>
  
  <p>Here is my code:</p>
  
  <pre><code>model = Sequential()
  
  model.add(LSTM(
      input_shape=(None, 1),
      units=50,
      return_sequences=True))
  model.add(Dropout(0.2))
  
  model.add(LSTM(
      200,
      return_sequences=False))
  model.add(Dropout(0.2))
  
  model.add(Dense(units=1))
  model.add(Activation('linear'))
  
  model.compile(lose='mse', optimizer='rmsprop')
  
  # Step 3. Train model
  model.fit(X_Training, Y_Training,
            batch_size=512,
            nb_epoch=5,
            validation_split=0.05)
  </code></pre>