Skip to content

Instantly share code, notes, and snippets.

@wezleysherman
Created July 31, 2020 05:07
Show Gist options
  • Save wezleysherman/58d3f8f748883f51f97c0a6d4d31b089 to your computer and use it in GitHub Desktop.
Save wezleysherman/58d3f8f748883f51f97c0a6d4d31b089 to your computer and use it in GitHub Desktop.
D = 512
#Simple RNN
T = train_X.shape[1]
i = Input(shape=(T,))
x = Embedding(V, D)(i)
x = Dropout(0.2)(x)
x = SimpleRNN(150)(x)
x = Dense(V, activation="softmax")(x)
rnn_model = Model(i, x)
rnn_model.summary()
adam = tf.keras.optimizers.Adam(learning_rate=0.001)
rnn_model.compile(optimizer=adam, metrics=["accuracy"], loss="categorical_crossentropy")
rnn_r = rnn_model.fit(train_X, train_y, epochs=50)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment