Search code examples
keraslstm

Understanding the time steps and samples in keras LSTM


I'm still confused about the time steps and samples in LSTMs networks. If I have this csv file I know that the features are the differents variables that we pass to the network, but for the rows i don't know if does represent the time steps or samples and if represent samples for example, what represent the time series and viseversa?

enter image description here


Solution

  • The number of rows, the Date field, is a sequence.

    You can divide that sequence into multiple (or single) input/output and that are your samples.

    For example, you can have two time steps as input and one time step as output.

    Hence, each sample has a specific number of time steps. The output is a single step (you can have multi step output as well).

    So, as we said, the inputs (two time-step)

    [1999.02.05 07:26, 1999.02.05 07:28]
    [1999.02.05 07:28, 1999.02.05 07:30]
    [1999.02.05 07:30, 1999.02.05 07:32]
    ....
    

    and so on