# Build the model model = Sequential() model.add( LSTM(input_dim=x_train.shape[-1], output_dim=50, return_sequences=True)) model.add(Dropout(0.2)) model.add(LSTM(100, return_sequences=False)) model.add(Dropout(0.2)) model.add(Dense(units=1)) model.add(Activation('linear')) start = time.time() model.compile(loss='mse', optimizer='rmsprop') print('compilation time : {}'.format(time.time() - start)) # In[ ]: # Train the model #nb_epoch = 350 model.fit(x_train, y_train, batch_size=3028, nb_epoch=30, validation_split=0.1) # In[ ]: # save the model because the training is long (1h30) and we don't want to do it every time """ # serialize model to JSON model_json = model.to_json()