pythontensorflowkerastime-serieslstm

lstm prediction result delay phenomenon


Recently I'm using lstm to predict time series. I'm using keras 2.0 to construct my lstm model. It has a structure like this:

model = Sequential()
model.add(LSTM(128, input_shape=(timesteps, 1), return_sequences=False, stateful=False)
model.add(Dropout(rate=0.1))
model.add(Dense(1))

I have tried to use this network to predict several time series including sin(t) and a real traffic flow dataset. I found that the prediction for sin is fine while the prediction for real dataset is just like shifting the last input value by one step. I don't know whether it's a prediction error or the network doesn't learn the pattern of the dataset at all. Does anyone get similar results? Are there any solutions to this annoying shift? Thanks a lot. Here are some of my predictions:

3 frequencies sin prediction result

real traffic dataset prediction result


Solution

  • This is simply the starting point for your network and you'll have to work through it by trying various things.

    To name only a few:

    The list goes on....