-
-
Save anadiedrichs/ec29d4d5c415baa6e6927cbd198940b2 to your computer and use it in GitHub Desktop.
I'll start by saying what I understand...
Your LSTM reads in 36 values of a single sensor in chronological order, and it produces a vector containing 18 values that will hopefully correspond to the next 18 values of the same sensor.
That's ok, it's the main issue in this notebook.
If you wanted to predict just the value 18 steps ahead, you would need to do
b = dataset[i + look_back + time_step,0]
increate_dataset
and the output_dim of the Dense layer would need to be 1 rather than T.
Ok, thanks for the comment. That's what I need to understand :-)
The problem I see is that the green lines are out of alignment. The following line of code seems pretty bizarre to me.
testPredictPlot[len(trainPredict)+(look_back*2)+1:len(dataset)-look_back+1, 0] = testPredict[:,0]
Firstly,
testPredict[:,0]
takes the first value of each output vector, which corresponds to the 1 step ahead predictions, not the T step ahead predictions - for that you would needtestPredict[:,T-1]
Secondly, I don't understand why you add(look_back*2)
and I suspect that is why the the green line is shifted out of alignment.
You probably need something like the following
testPredictPlot[train_size+look_back:len(dataset), 0] = testPredict[:,0]
Yes, I've also noticed. I was looking for a way to analyze the error.
I think I get it and I improve the example --> https://gist.github.com/anadiedrichs/f847659d5570938f5f300efb16f81ece
Thanks a lot for your comments!!!
I'll start by saying what I understand...
Your LSTM reads in 36 values of a single sensor in chronological order, and it produces a vector containing 18 values that will hopefully correspond to the next 18 values of the same sensor.
If you wanted to predict just the value 18 steps ahead, you would need to do
b = dataset[i + look_back + time_step,0]
increate_dataset
and the output_dim of the Dense layer would need to be 1 rather than T.The problem I see is that the green lines are out of alignment. The following line of code seems pretty bizarre to me.
testPredictPlot[len(trainPredict)+(look_back*2)+1:len(dataset)-look_back+1, 0] = testPredict[:,0]
Firstly,
testPredict[:,0]
takes the first value of each output vector, which corresponds to the 1 step ahead predictions, not the T step ahead predictions - for that you would needtestPredict[:,T-1]
Secondly, I don't understand why you add
(look_back*2)
and I suspect that is why the the green line is shifted out of alignment.You probably need something like the following
testPredictPlot[train_size+look_back:len(dataset), 0] = testPredict[:,0]