Keras LSTM Multidimensional Output Error — Expected Time_distributed_17 To Have 3 Dimensions, But Got Array With Shape (1824, 3)
I am trying to predict multidimensional values in sequence, e.g. [[0, 0, 2], [1, 0, 3], [2, 3, 4], [3, 2, 5], [4, 0, 6], [5, 0, 7] ... ] and want each of the [x, y, z] dimensions t
Solution 1:
You have a mismatch in what the model predicts, currently 3D, and what the target is, 2D. You have 2 options:
- Apply
Flatten
and removeTimeDistributed
which means the model will predict based on the entire sequence. - Remove
return_sequences=True
from last LSTM to let the LSTM compress the sequence and again removeTimeDistributed
. This way the model will predict based on the last LSTM output not the sequences.
I would prefer the second option given the size of the sequence and the number of hidden units you have. Option one will create a very large kernel for the Dense layer if you just flatten the sequence, i.e. too many parameters.
Post a Comment for "Keras LSTM Multidimensional Output Error — Expected Time_distributed_17 To Have 3 Dimensions, But Got Array With Shape (1824, 3)"