The embedding block represents a layer can be used to turn a categorical variable, expressed as an integer (different integer values correspond to different categories) into a vector of real numbers. This can be used as an alternative to categorical encoding, and since the vector is trainable we can expect categories that have a similar effect on the model to be mapped to similar vectors over time. The name indeed comes from the fact that this process creates an embedding space for the categorical variable, where we can observe similarities and differences between categorical labels.
Embedding layers can only be used immediately after an Input block.
Input dimension: the number of possible integer values e.g. the unique values of the categorical variable.
Output dimension: the dimension of the embedding space, i.e. the size of the vector.
Trainable: whether we want the training algorithm to change the value of the weights during training. In some cases, one will want to keep parts of the network static, for instance when using the encoder part of an autoencoder as preprocessing for another model.
Stay in the know by signing up for occasional emails with tips, tricks, deep learning insights, product updates, event news and webinar invitations.
We promise not to spam you or share your email with any third party. You can change your preferences at any time. See our privacy policies.
Please check your email inbox account to confirm, set, or update your communication preferences.