1

I am trying to predict some time series based on precedent values using LSTM.

I have pretty good results when I compare the predicted time series with the test set (0,18% error)

I just miss how to forecast outside the interval of data ^^'

I have to admit that I used a point by point prediction method that looks like this:

def predict_point_by_point(model, data): 
    predicted = model.predict(data)
    predicted = np.reshape(predicted, (predicted.size))
    return predicted

I then, I used it to override the predict function. maybe the original function could have nailed the prediction to have a future time series? maybe the point by point isn't that bad neither?

I mean; how could I predict, some precise interval of time series (3months for example) without just reffering to the test set?

Example: the test set starts 01/01/2018 and ends 01/12/2018 and I want to predict 4 months from 02/12/2018

Thanks in advance for your help

Nour
  • 35
  • 6

1 Answers1

0

Let's say you trained a forecasting model using the following base data:

time       | index_1 | index_2 | label
01/01/2018 | 80      | 70      | 1
01/02/2018 | 60      | 30      | 0
01/03/2018 | 75      | 90      | 1

You used time, index_1 and index_2 to predict label. Then you would simply need a dataset like this to predict 01/04/2018:

time       | index_1 | index_2
01/04/2018 | 60      | 75      

Using your model on this data set should predict the label-value.

Now in a time series this can be more complicated, let's say what you actually want to predict is the label-value of time X from the indicie values of time X-4 months. In this case your data to build the model should look like this:

time       | index_1_lag_4_months | index_2_lag_4_months | label
01/04/2018 | 80                   | 70                   | 1
01/05/2018 | 60                   | 30                   | 0
01/06/2018 | 75                   | 90                   | 1

This model would predict the label-value for 01/04/2018 based on the indice values of 01/01/2018. To actually get a prediction we again give a data set like this:

time       | index_1 | index_2
01/04/2018 | 60      | 75      

Only the output would not be the label-value for 01/04/2018 but instead for 01/08/2018.

Fnguyen
  • 1,773
  • 6
  • 15