Skip to content

Instantly share code, notes, and snippets.

@AmrutaKoshe
Created June 24, 2021 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AmrutaKoshe/cd701d6c322c44a27b20f56a862a1dfb to your computer and use it in GitHub Desktop.
Save AmrutaKoshe/cd701d6c322c44a27b20f56a862a1dfb to your computer and use it in GitHub Desktop.
Sequential model
#Train a sequential model
# Define the neural network
embedding_dim = 64
model = tf.keras.Sequential([
# Add an Embedding layer expecting input vocab of size 6000, and output embedding dimension of size 64 we set at the top
tf.keras.layers.Embedding(vocab_size, embedding_dim, input_length=1),
tf.keras.layers.Bidirectional(tf.keras.layers.LSTM(embedding_dim)),
#tf.keras.layers.Dense(embedding_dim, activation='relu'),
# use ReLU in place of tanh function since they are very good alternatives of each other.
tf.keras.layers.Dense(embedding_dim, activation='relu'),
# Add a Dense layer with 25 units and softmax activation for probability distribution
tf.keras.layers.Dense(26, activation='softmax')
])
model.summary()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment