Skip to content

Instantly share code, notes, and snippets.

@khuangaf
Created January 1, 2018 06:52
Show Gist options
  • Save khuangaf/dd82d147ec1c66ae61cd9aa6b3d76718 to your computer and use it in GitHub Desktop.
Save khuangaf/dd82d147ec1c66ae61cd9aa6b3d76718 to your computer and use it in GitHub Desktop.
def fit_lstm(reg):
global training_datas, training_labels, batch_size, epochs,step_size,nb_features, units
model = Sequential()
model.add(CuDNNLSTM(units=units, bias_regularizer=reg, input_shape=(step_size,nb_features),return_sequences=False))
model.add(Activation('tanh'))
model.add(Dropout(0.2))
model.add(Dense(output_size))
model.add(LeakyReLU())
model.compile(loss='mse', optimizer='adam')
model.fit(training_datas, training_labels, batch_size=batch_size, epochs = epochs, verbose=0)
return model
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment