Skip to content

Instantly share code, notes, and snippets.

@under0tech
Created September 16, 2022 18:38
Show Gist options
  • Save under0tech/b423fb2cce918c908a0320bf2a8715e9 to your computer and use it in GitHub Desktop.
Save under0tech/b423fb2cce918c908a0320bf2a8715e9 to your computer and use it in GitHub Desktop.
def GetTrainedModel(x_train, y_train):
model = Sequential()
model.add(LSTM(60, return_sequences=True, input_shape=(N_STEPS, len(['close']))))
model.add(Dropout(0.3))
model.add(LSTM(120, return_sequences=False))
model.add(Dropout(0.3))
model.add(Dense(20))
model.add(Dense(1))
BATCH_SIZE = 8
EPOCHS = 80
model.compile(loss='mean_squared_error', optimizer='adam')
model.fit(x_train, y_train,
batch_size=BATCH_SIZE,
epochs=EPOCHS,
verbose=1)
model.summary()
return model
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment