2
$\begingroup$

It's hard to find literature where LTSM are used with multidimensional input.

I know that LTSM admits various time series as input (multidimensional input) with the shape : (samples,look back,dimension).Dimension could be, electricity demand, temperature, pressure, day of the week,... among others.

The question is: If you want to forecast the next X samples of one of the features, is it forcing you to also forecast the other "drivers"? Thereby, has the target vector be of the same dimensionality as the input one?

Then I understand that there is not any difference between the "main" magnitude to forecast and the "drivers" as you are forced to forecast all of them.

Maybe LSTM is not designed for this use and I'm confused...

$\endgroup$
2
  • 1
    $\begingroup$ The target doesn't have to have the same dimensionality. It doesn't even have to be one of the input components. For example if the inputs are (electricity,temperature) a predicted output could be pressure. $\endgroup$ – Alex R. Jul 28 '17 at 17:21
  • 1
    $\begingroup$ Thanks Alex! And how can I forecast the next "n" timesteps rather than a single timestep? $\endgroup$ – J.Cirera Jul 31 '17 at 7:06
1
$\begingroup$

If you want to forecast multiple time steps then yes, your output is going to have to be of the same dimension as your input. The input dimension is fixed, so if you aren't producing a prediction for every input, some of the inputs during prediction time would be missing and it would throw off your results if you just filled them in with 0s.

If you just want to make a prediction n time steps in the future and are less worried about the predictions in between, you can just train your model on predicting time t + n at every time step t and you won't have this issue, but you also won't be able to do an arbitrary number of predictions.

To do this it is just a matter of changing what your target value is during training. Instead of making your target whatever value comes next in the sequence, you could make it whatever the value is 5 steps ahead (time t + 5) for example. Other than that everything is the same.

One other idea is to have your output be a sequence also. For example if you were trying to predict how many sales a company will have in the future. Say your data is daily observations, and you want to predict what the next 7 days will be. You can have your network output 7 values at each time step, one corresponding to each day, instead of just one. This method may take away some of the power of the LSTM though. Normally each individual prediction will update the hidden state for making the next one, but with this they would all be predicted at once. It would probably come down to testing to say whether that is a problem and which method will work the best for your data.

$\endgroup$
2
  • $\begingroup$ Thanks a lot @Frobot, could you make a pseudocode example about the multiple time steps forecasting?I would appreciate it a lot. $\endgroup$ – J.Cirera Aug 1 '17 at 7:10
  • $\begingroup$ I updated my answer and also added another idea $\endgroup$ – Frobot Aug 1 '17 at 18:18
0
$\begingroup$

Say you observed daily data over months of 7 different features (like weather, pressure, ..). Now you want to use one month of data, i.e. a sequence of 30 observation with 7 features each to predict one week of some other feature, i.e. your output is a sequence of 7 observations with 1 feature. This output feature does not have to be included in the input features!And as you see, the dimensions are completely independet of each other.

Have a look at https://machinelearningmastery.com/how-to-develop-lstm-models-for-multi-step-time-series-forecasting-of-household-power-consumption/ This side really helped me a lot in understanding the forecasting of time series with neural nets and he provides lots of code examples as well

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.