I have a dataset with sales numbers for around 100 related products. Every day, the number of sales of each product is recorded along with other relevant information (what day of the week is it, is it a public holiday, what is the weather like etc. etc.).

So essentially this is a time series with daily entries, and I am thinking of pushing this through an LSTM.

My question is, how do I deal with the fact that I have multiple observations at every point in time?

Day         Product        Wheather        NumberSold
1 Jan       Meat           Sunny           15
1 Jan       Apples         Sunny           211
1 Jan       Fries          Sunny           5
1 Jan       Carrots        Cloudy          75
2 Jan       Meat           Cloudy          10
2 Jan       Apples         Cloudy          220

Do I have to divide my dataset up by product so as to have only one entry per day to feed into the LSTM? Or is there a way to deal with all of the 1 Jan observations as a sort of batch that is remembered?

  • $\begingroup$ What are you predicting, NumberSold? Split it up between products and use all the products for your prediction (if you think the products are correlated). $\endgroup$
    – Hobbes
    Sep 26, 2017 at 18:28
  • $\begingroup$ LSTMs and other RNNs can handle multidimensional inputs out of the box. Why do you think they cannot? $\endgroup$
    – kbrose
    Jun 28, 2018 at 14:49
  • $\begingroup$ LSTM's can perfectly handle multidimensionality, so no need to worry there. However, depending on what you're trying to predict, you may need to prepare your data accordingly. $\endgroup$
    – Riley
    Jun 3, 2019 at 14:24

1 Answer 1


If I am getting it correctly, you are facing a problem in training an LSTM for a multivariate timeseries dataset.

This problem is called as the multivariate time-series problem.

Here is a tutorial to learn it quickly


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.