Contents
Which is the best LSTM model for keras?
Because my Sequence column can have a variable number of elements in the sequence, I believe an RNN to be the best model to use. Below is my attempt to build an LSTM in Keras:
What should the input shape of a LSTM look like?
I know that LSTM’s in Keras require a 3D tensor with shape (nb_samples, timesteps, input_dim) as an input. However, I am not entirely sure how the input should look like in my case, as I have just one sample of T observations for each input, not multiple samples, i.e. (nb_samples=1, timesteps=T, input_dim=N).
How to feed LSTM with different input array sizes?
For example, a padded temperature sequence [20, 21, 22, -10, -10] will be the same as a sensor report with two noisy (wrong) measurements at the end. Model may learn to ignore this noise completely or at least partially, but it is reasonable to clean the data first, i.e. use a mask.
Is there a 3D tensor for a LSTM neural network?
You’re right that Keras is expecting a 3D tensor for an LSTM neural network, but I think the piece you are missing is that Keras expects that each observation can have multiple dimensions. For example, in Keras I have used word vectors to represent documents for natural language processing.
How are zeros appended to length in keras?
You can do this in Keras with : If the sequence is shorter than the max length, then zeros will appended till it has a length equal to the max length. If the sequence is longer than the max length then, the sequence will be trimmed to the max length.
What happens if we pad without masking in keras?
Note that if we pad without masking, padded value will be regarded as actual value, thus, it becomes noise in data. For example, a padded temperature sequence [20, 21, 22, -10, -10] will be the same as a sensor report with two noisy (wrong) measurements at the end.