- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable
public class EmbeddingLayer
extends FeedForwardLayer
Embedding layer: feed-forward layer that expects single integers per example as input (class numbers, in range 0 to numClass-1)
as input. This input has shape [numExamples,1] instead of [numExamples,numClasses] for the equivalent one-hot representation.
Mathematically, EmbeddingLayer is equivalent to using a DenseLayer with a one-hot representation for the input; however,
it can be much more efficient with a large number of classes (as a dense layer + one-hot input does a matrix multiply
with all but one value being zero).
Note: can only be used as the first layer for a network
Note 2: For a given example index i, the output is activationFunction(weights.getRow(i) + bias), hence the
weight rows can be considered a vector/embedding for each example.
- See Also:
- Serialized Form