I'm learning TensorFlow and LSTM and I'm wondering why my prediction output has multiple values when I'm training it to return one. My goal is to get a single value between 0 and 1 after training it with arrays for sentiment analysis.
The training input data looks like:
[[59, 21, ... 118, 194], ... [12, 110, ... 231, 127]]
All input arrays are of the same length padded with 0. The training target data looks like:
[1.0, 0.5, 0.0, 1.0, 0.0 ...]
Model:
model = Sequential()
model.add(Embedding(input_length, 64, mask_zero=True))
model.add(LSTM(100))
model.add(Dense(1, activation=tf.nn.sigmoid))
Why does the prediction seem to evaluate each individual value at a time instead of an array as a whole?
model.predict([192])
# Returns [[0.5491102]]
model.predict([192, 25])
# Returns [[0.5491102, 0.4923803]]
model.predict([192, 25, 651])
# Returns [[0.5491102, 0.4923803, 0.53853387]]
I don't want to take an average of the output because the relationships between the values in the input arrays matter for sentiment analysis. If I'm training to predict a single value I'm not understanding why a single value isn't output. I'm new to TensorFlow, Keras, and layered neural networks, so I'm sure I'm missing something obvious.
model.predict([[192, 25]])?