I'm looking into using TimeDistributed
in my LSTM to see if it would improve the accuracy of my model. I'll be honest, I'm still not 100% sure what the specific use case for TimeDistributed
, I just thought I'd give it a try and see if it improved my accuracy. Aside from blind trial/error, why would someone use TimeDistributed
?
Now, my next question is probably tied to my lack of understanding of exactly what TimeDistributed
's specific use case is, but I understand that the output from TimeDistributed
is a sequence, and that sequence is the same length as the input sequence because you use return_sequences=True
on the final layer of the model (all of them in my case, as it's stateful).
In my case I'm inputting a sequence which is 100 length, and I'm then forecasting a sequence of length 3 from that input sequence, but I get this error:
Error when checking target: expected time_distributed_1 to have shape (100, 3) but got array with shape (3, 1)
Am I right in assuming that you can only use TimeDistributed
if your output sequence is the same length as the input sequence?
Many thanks
Which, in your case, would trim the first 97 time points and would leave you with the last 3. That would fit the shape of your target data.
– Moran Neuhof Nov 04 '18 at 19:48