Reader small image

You're reading from  Deep Learning Quick Reference

Product typeBook
Published inMar 2018
Reading LevelExpert
PublisherPackt
ISBN-139781788837996
Edition1st Edition
Languages
Right arrow
Author (1)
Mike Bernico
Mike Bernico
author image
Mike Bernico

Mike Bernico is a Lead Data Scientist at State Farm Mutual Insurance Companies. He also works as an adjunct for the University of Illinois at Springfield, where he teaches Essentials of Data Science, and Advanced Neural Networks and Deep Learning. Mike earned his MSCS from the University of Illinois at Springfield. He's an advocate for open source software and the good it can bring to the world. As a lifelong learner with umpteen hobbies, Mike also enjoys cycling, travel photography, and wine making.
Read more about Mike Bernico

Right arrow

Keras embedding layer

The Keras embedding layer allows us to learn a vector space representation of an input word, like we did in word2vec, as we train our model. Using the functional API, the Keras embedding layer is always the second layer in the network, coming after the input layer.

The embedding layer needs the following three arguments:

  • input_dim: The size of the vocabulary of the corpus.
  • output_dim: The size of the vector space we want to learn. This would correspond to the number of neurons in word2vec hidden layer.
  • input_length: The number of words in the text we're going to use in each observation. In the examples that follow, we will use a fixed size based on the longest text we need to send and we will pad smaller documents with 0s.

An embedding layer will output a 2D matrix for each input document that contains one vector for each word in the sequence specified...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Deep Learning Quick Reference
Published in: Mar 2018Publisher: PacktISBN-13: 9781788837996

Author (1)

author image
Mike Bernico

Mike Bernico is a Lead Data Scientist at State Farm Mutual Insurance Companies. He also works as an adjunct for the University of Illinois at Springfield, where he teaches Essentials of Data Science, and Advanced Neural Networks and Deep Learning. Mike earned his MSCS from the University of Illinois at Springfield. He's an advocate for open source software and the good it can bring to the world. As a lifelong learner with umpteen hobbies, Mike also enjoys cycling, travel photography, and wine making.
Read more about Mike Bernico