you often find applications that divide RNN according to their input and output data into the categories:

  • One-To-One
  • One-To-Many
  • Many-To-One
  • Many-To-Many

as you can see e.g. (here https://stackoverflow.com/questions/42334335/how-to-structure-an-lstm-neural-network-for-classification).

Let's say I have a timeseries of past electricity data of the last day (with a resolution of 1 hour), and I want to forecast the next timestep based on the input using a RNN. Is this a a "Many-To-One" type application? So does the "Many" mean, that we have multiple timeslots or does the "Many" mean, that we have a multivariate timeseries with multiple values for one timeslots (e.g. additionally having temperature values)?


1 Answer 1


This type of problem normally is set up as many-to-many, where the input is a piece of time series and the expected output is the same time series shifted one position to the left so that, for each time step, you predict the next value:

enter image description here

To understand what "many" means in this context take this into account: an LSTM always receives a sequence as input and generates a sequence as output; however, the designer can decide to "ignore" parts of the output of an LSTM. To ignore part of the LSTM output, you simply don't take it into account in the training loss. For instance, in the many-to-one setup, you ignore all the output timesteps except the last one.

The "many" has nothing to do with timeslots or multivariate timeseries.

Take into account, nevertheless, that the inputs and outputs at each time step are vectors. You can, of course, have vectors with dimensionality 1 as inputs/outputs, i.e. scalars.

  • $\begingroup$ Thanks Noe for your answer. I have some follow-up question. 1) You wrote " For instance, in the many-to-one setup, you ignore all the output timesteps except the last one." --> This is exactly the setup when using the past 24 hours to predict the next hour. So why do you label the forecasting then as "many-to-many" 2)You wrote "The "many" has nothing to do with timeslots or multivariate timeseries." --> What is the "one" and "many" then referring to if not the different timeslots or different vectors for the different time slots? 3) What do you mean by having vectors as input or output? $\endgroup$
    – PeterBe
    Oct 6, 2023 at 12:13
  • $\begingroup$ 1) You could do that, but that way you are not taking advantage of all the training data you have. If you do it with a many-to-many scheme, your network learns to predict with a variable amount of input timesteps and normally this leads to better results, even if you end up just using it to predict the next value with always the same number of input timesteps. 2) The "many" refers to the number of timesteps taken into account, either input or output. 3) The input and output of an LSTM at each time step is a fixed-length vector of real numbers, like [3.2, -1.0, 3.0, -0.1]. $\endgroup$
    – noe
    Oct 6, 2023 at 13:36

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.