Skip to content

Instantly share code, notes, and snippets.

@saivarunk
Created January 12, 2019 18:25
Show Gist options
  • Save saivarunk/9fae58eb5f74045c8a694304b19ba029 to your computer and use it in GitHub Desktop.
Save saivarunk/9fae58eb5f74045c8a694304b19ba029 to your computer and use it in GitHub Desktop.
def build_bidirectional_model(X, y):
# define model
model = Sequential()
model.add(Bidirectional(LSTM(50, activation='relu'), input_shape=(n_steps, n_features)))
model.add(Dense(1))
model.compile(optimizer='adam', loss='mse')
# fit model
model.fit(X, y, epochs=200, verbose=0)
return model
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment