Does the ordering of 'rows' at the level of timesteps matter, for a RNN input in Keras?
Asked Answered
M

1

0

An RNN, in keras, accepts an input with the following shape

array([[['Xa0', 'Ya0'],
    ['Xa1', 'Ya1'],
    ['Xa2', 'Ya2']],

   [['Xb0', 'Yb0'],
    ['Xb1', 'Yb1'],
    ['Xb2', 'Yb2']],

   [['Xc0', 'Yc0'],
    ['Xc1', 'Yc1'],
    ['Xc2', 'Yc2']]], dtype='<U3')

The numbers are associated with the time steps (3 in our case), and X,Y are features. We have 3 batches (a,b,c).

Which order should I use:

  1. 0 -> 2 from past to present?
  2. 0 -> 2 from present to past?

and why?

Monopolist answered 19/2, 2022 at 11:3 Comment(1)
Voting to close without any comments, it's not very helpful...Monopolist
G
0

What do you want to infer from the data?

Do you want to classify it? Get a "true/false" result? Make a regression?

Any order is ok. Use the one that gives your network the best result. There is even the possibility of using Bidirectional layers, that will read the data both from past to present and from present to past.

Do you want to predict next steps?

Use the order that leads to the steps you want to predict.

Gigantes answered 21/2, 2022 at 13:5 Comment(2)
Thanks Daniel! Btw, how many time_steps should one use? is there a criteria for choosing that number?Monopolist
Test it. Usually, LSTM layers can take a very long number of steps. Of course, if you want to classify a sequence, you need the entire sequence.Lunge

© 2022 - 2024 — McMap. All rights reserved.