Embedding the model
The embedding model is constructed using the Layers API. tf.layers.embedding allows us to train the mapping in order to embed words into fixed-length vectors. The size of the input dimension is the vocabulary size, and each output should have an embeddingSize-length vector. Please note that inputLength is the maximum length of the sentence in the dataset, which is different from inputDim. Since the target label is a positive/negative flag, the sigmoid activation function is used after the output of the embedding is flattened. One interesting thing about this is that this embedding can take labels into consideration. These are set in terms of the application's purpose. This indicates the flexibility in customizing the embedded ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access