Created
November 13, 2019 09:31
-
-
Save joeng03/6dc52079b7825cfa7abaeae8b7575862 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from keras.models import Sequential | |
from keras.layers import Dense, Dropout,LSTM | |
from keras.optimizers import Adam | |
model = Sequential() | |
model.add(LSTM(units=100,input_shape=(x_train.shape[1],1),return_sequences=True)) | |
model.add(LSTM(units=100)) | |
model.add(Dropout(0.4)) | |
model.add(Dense(1)) | |
ADAM = Adam(0.0005, beta_1=0.9, beta_2=0.999, amsgrad=False) | |
model.compile(loss='mean_squared_error', optimizer=ADAM) | |
history = model.fit(x_train,y_train,epochs=50,batch_size=72,validation_data=(x_test,y_test),verbose=1,shuffle=False) | |
plt.plot(history.history['loss'], label='train') | |
plt.plot(history.history['val_loss'], label='test') | |
plt.legend() | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment