I am trying a simple document classification using sentence embeddings in keras.
I know how to feed word vectors to a network, but I have problems using sentence embeddings. In my case, I have a simple representation of sentences (adding the word vectors along the axis, for example np.sum(sequences, axis=0)
).
My question is, what should I replace the Embedding
layer with in the code below to feed sentence embeddings instead?
model = Sequential()
model.add(Embedding(len(embedding_weights), len(embedding_weights[0]), weights=[embedding_weights], mask_zero=True,
input_length=MAX_SEQUENCE_LENGTH, trainable=True))
model.add(LSTM(LSTM_SIZE, activation='relu'))
I've tried Embedding
layer (without setting the weights) and Input
layer but both gave errors.