Is there a way to use LSTM to predict a time-series with an exogenous variable like there is when using SARIMAX models?

Viewed 774

I was trying to forecast a time-series with exogenous variables and have been successful in forecasting with SARIMAX models, I was trying to do the same using RNN models (specifically LSTM model) but was unable to find any way to implement an exogenous variable (which I have the complete history of), but this variable affects the time-series and thus needs to be accounted for. Greatly appreciate your help Thank you

1 Answers

Check cond-rnn. It is a library that implements what you are looking for.

Useful if you have time series data with other inputs that do not depend on time. For example, weather data from two different cities: Paris and San Francisco. You want to predict the next temperature based on historical data. But at the same time, you expect the weather to change based on the city. You can either:

  • Combine the auxiliary features with the time series data (ugly!).

  • Concatenate the auxiliary features with the output of the RNN layer. It's some kind of post-RNN adjustment since the RNN layer won't see this auxiliary info.

  • Or just use this library! Long story short, initialize the RNN states with a learned representation of the condition (e.g. Paris or San Francisco). This way you model elegantly P(x_{t+1}|x_{0:t}, cond).

And it is really easy to use

outputs = cond_rnn.ConditionalRNN(units=NUM_CELLS, cell='LSTM')([inputs, cond])
Related