Keras - Embedding Layer



It performs embedding operations in input layer. It is used to convert positive into dense vectors of fixed size. Its main application is in text analysis. The signature of the Embedding layer function and its arguments with default value is as follows,

keras.layers.Embedding (
   input_dim, 
   output_dim, 
   embeddings_initializer = 'uniform', embeddings_regularizer = None, 
   activity_regularizer = None, 
   embeddings_constraint = None, 
   mask_zero = False, 
   input_length = None
)

Here,

  • input_dim refers the input dimension.

  • output_dim refers the dimension of the dense embedding.

  • embeddings_initializer refers the initializer for the embeddings matrix

  • embeddings_regularizer refers the regularizer function applied to the embeddings matrix.

  • activity_regularizer refers the regularizer function applied to the output of the layer.

  • embeddings_constraint refers the constraint function applied to the embeddings matrix

  • mask_zero refers the input value should be masked or not.

  • input_length refers the length of input sequence.

Advertisements