daily pastebin goal
51%
SHARE
TWEET

Untitled

a guest Feb 23rd, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. model = Sequential()
  2. model.add(LSTM(units = 50, return_sequences = True , input_shape = (X_train.shape[1], 1)))
  3. model.add(Dense(units = 1))
  4. model.compile(optimizer = 'adam', loss = 'mean_squared_error')
  5. model.fit(X_train, y_train, epochs = 100, batch_size = 32)
  6.      
  7. new_model = Sequential()
  8. new_model.add(LSTM(units = 50, return_sequences = True , input_shape = (1 , 60 , 1 )))
  9. new_model.add(Dense(1))
  10. old_weights = model.get_weights()
  11. new_model.set_weights(old_weights)
  12. new_model.compile(optimizer = 'adam', loss = 'mean_squared_error')
  13.  
  14. inputs = []
  15. for i in range(10):
  16.     inputs = dataset_total[len(dataset_total) - 60:].values
  17.     inputs = np.reshape(inputs, (1 , 60, 1))
  18.     predicted = new_model.predict(inputs)
  19.     inputs.append(predicted)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top