I am predicting energy usage for a bedroom within a school residential building with date, temperature, and humidity as input features, using 7 time-steps and predicting for one-day (one-timestep).

I am able to predict for one bedroom. The building has about 100 bedrooms, all more or less the same layout and occupancy, so the data for all these 100 bedrooms have the same date range as the first bedroom and same humidity and temperature levels on the same day. Now I want to train my model with all the 100 bedroom's energy data so that the model captures all 100 rooms energy patterns.

Then, I want to predict what the energy usage is for any given bedroom (not a specific bedroom), using this model that has been trained with all 100 bedrooms. In other words, the business question is "What is the expected energy usage for a bedroom within this residential school building?"

I would like to know how I can train all these 100 rooms into one LSTM model, given that LSTM is a time series model, and 100 rooms mean I have 100 times series. I cannot simply concatenate the datasets of all rooms.

How would I structure my data and run it in the LSTM model?

I would appreciate if someone could show me an example of how it could be done.

  • 2
    $\begingroup$ did you get any answer to your own question? if you have any working solution, kindly post it, I am also having similar kind of problem, where I am dealing with multiple time series. $\endgroup$ Commented May 9, 2019 at 18:19
  • $\begingroup$ Can you implement a single model, and train it for all rooms' data? $\endgroup$
    – Leevo
    Commented Jul 12, 2020 at 9:19

1 Answer 1


As you mention, all rooms have similar properties, thus it makes sense developing a single LSTM model for all of them.

You have to pre-process your data so that you have input vectors $X_i$ of 7 time steps and 1 time step as label vector $Y_i$:

$ X_i = [x_i[t-6 ],x_i[t-5 ],x_i[t-4 ],x_i[t-3 ],x_i[t-2],x_i[t-1 ],x_i[t]]\\ Y_i = [x_i[t+1]] $

where the subscript $i$ denotes the $i_{th}$ vector.

Let's imagine you can generate 100 vectors for each room, you'll end up with a dataset of $10^4$ input vectors. The number of vector per room will depend on the overlap you use, for instance, if you have data for 100 days per each room and you use an overlap of 99 days (your window slides one day in the future), you'll have 99 vectors for each room.

To train the LSTM you use the typical Mini-batch training. Make sure you don't propagate the state for batch sample $i$ to sample $i+1$ in order to treat them individually (in Keras you set the stateful flag to False)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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