Skip to Content
Neural Network Projects with Python
book

Neural Network Projects with Python

by James Loy
February 2019
Beginner to intermediate
308 pages
7h 42m
English
Packt Publishing
Content preview from Neural Network Projects with Python

Word embedding and LSTM layers

With our input preprocessed, we can now turn our attention to model building. As always, we will use the Sequential class in Keras to build our model. Recall that the Sequential class allows us to stack layers on top of one another, making it really easy to build complex models layer by layer.

As always, let's define a new Sequential class:

from keras.models import Sequentialmodel = Sequential()

We can now add the word embedding layer to our model. The word embedding layer can be constructed directly from the keras.layers as follows:

from keras.layers import Embedding

The Embedding class takes the following important arguments:

  • input_dim: The input dimensions of the word embedding layer. This should be the ...
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.
Start your free trial

You might also like

Machine Learning with Python Cookbook

Machine Learning with Python Cookbook

Chris Albon

Publisher Resources

ISBN: 9781789138900Supplemental Content