Reputation: 169
I am using LSTM neural networks (stateful) for time series prediction.
I'm hoping that the stateful LSTM can capture the hidden patterns and make a satisfactory prediction (the physical law that cause the variation of the time series is not clear).
I have a time series X
with a length of 1500
(actual observational data), and my purpose is to predict the future 100
.
I suppose predict the next 10
will be more promising than predict the next 100
(is that right?).
So, I prepare the training data like this (always using 100
values to predict the next 10
; x_n
denotes the n-th
element in X
):
shape of trainX: [140, 100, 1]
shape of trainY: [140, 10, 1]
---
0: [x_0, x_1, ..., x_99] -> [x_100, x_101, ..., x_109]
1: [x_10, x_11, ..., x_109] -> [x_110, x_111, ..., x_119]
2: [x_20, x_21, ..., x_119] -> [x_120, x_121, ..., x_129]
...
139: [x_1390, x_1391, ..., x_1489] -> [x_1490, x_1491, ..., x_1499]
---
After the training, I want to use the model to predict the next 10
values [x_1500 - x_1509]
with [x_1400 - x_1499]
, and then predict the next 10
values [x_1510 - x_1519]
with [x_1410 - x_1509]
.
Is this the right way?
After a lot of reading of documents and examples, I can train a model and make the prediction, but the result seems not satisfactory.
To validate the method, I assume that the last 100 (x_1400 - x_1499)
values are unknown, and remove them from trainX
and trainY
, then try to train a model and predict them. Lastly, compare the predicted values with the observed values.
Any suggestions or comments will be appreciated.
The time series looks like this:
Upvotes: 2
Views: 1209
Reputation: 40506
Your question is really complexed. Before I will try to answer it - I'll share my doubts with you about is it sensible to use LSTM
for your task. You want to use a really advanced model (LSTM
are capable to learn really complexed patterns) to a time series which seems to be relatively easy. Moreover - you have a really small amout of data. To be honest - I would try to train simpler and easier methods first (like ARMA
or ARIMA
).
To answer your question - if your approach is good - it seems to be reasonable. Other reasonable methods are predicting all 100
steps or e.g. 50
steps twice. With 10
steps you might come across error cumulation - but still it might be a good method.
As I mentioned earlier - I would rather try easier ML
method for this task but if you really want to use LSTM
you may tackle this problem in a following way:
k-fold
crossvalidation.You have relatively small amount of data so you may easily find the best values of hyperparameters. This will also show you if your approach is good or not - simply check the results provided by the best solution.
Upvotes: 4