Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- model = Sequential()
- model.add(LSTM(units = 50, return_sequences = True , input_shape = (X_train.shape[1], 1)))
- model.add(Dense(units = 1))
- model.compile(optimizer = 'adam', loss = 'mean_squared_error')
- model.fit(X_train, y_train, epochs = 100, batch_size = 32)
- new_model = Sequential()
- new_model.add(LSTM(units = 50, return_sequences = True , input_shape = (1 , 60 , 1 )))
- new_model.add(Dense(1))
- old_weights = model.get_weights()
- new_model.set_weights(old_weights)
- new_model.compile(optimizer = 'adam', loss = 'mean_squared_error')
- inputs = []
- for i in range(10):
- inputs = dataset_total[len(dataset_total) - 60:].values
- inputs = np.reshape(inputs, (1 , 60, 1))
- predicted = new_model.predict(inputs)
- inputs.append(predicted)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement