Created
June 24, 2021 13:35
-
-
Save AmrutaKoshe/cd701d6c322c44a27b20f56a862a1dfb to your computer and use it in GitHub Desktop.
Sequential model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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