machine-learninglstmrecurrent-neural-networkforecastsarimax

Does it exist a LSTM model that can have exogenous factors same as SARIMAX?


I have been working with SARIMAX a while now. I try to predict energy usage in large buildings. Im using weather data as exogenous variables. As I know the predicted weather from the weather forecast i use this data in the prediction as well. I try to predict day ahead with sampling time 1 hour, so t_1 -> t_24.

Does it exist any LSTM/RNN that can use input in the prediction, like the weather forecast?

Example:

Data 0 < t is used as training data. Want to predict X for t > 0.

 time                  X    Y
 t-4                   22   33
 t-3                   23   44
 t-2                   25   44
 t-1                   22   55
 t                     21   22   
 t+1           -----   ?    22   -----
 t+2                   ?    13
 t+3  Want to predict  ?    14    Forecast weather data
 t+4                   ?    32
 t+5           -----   ?    12   -----

Solution

  • You can handover as many variables/features to LSTM as you want. In the first layer you specify the input_shape(length, width), this defines how the first layer expects input. For example, if you have 4 weather features (called "exogenous" features), you need to specify the input like this:

    model.add(LSTM(units=number_of_neurons), input_shape=(window_length, 5))
    

    Keep in mind that you need to pass the building temperatur (called "target" or "endogenous" variable) and 4 exogenous features, hence 5. And just like with SARIMAX, you need to pass the exogenous data for training/predictions.