Skip to content

Instantly share code, notes, and snippets.

@lylayang
Last active March 28, 2020 19:51
Show Gist options
  • Save lylayang/9951aa7a519ab4c3d429eb72eb9cce48 to your computer and use it in GitHub Desktop.
Save lylayang/9951aa7a519ab4c3d429eb72eb9cce48 to your computer and use it in GitHub Desktop.
from keras.models import Sequential
from keras.layers import Dense, SimpleRNN
from keras.callbacks import EarlyStopping
def model_rnn(look_back):
model=Sequential()
model.add(SimpleRNN(units=32, input_shape=(1,look_back), activation="relu"))
model.add(Dense(8, activation='relu'))
model.add(Dense(1))
model.compile(loss='mean_squared_error', optimizer='adam',metrics = ['mse', 'mae'])
return model
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment