Reputation: 13
I recently started working with LSTM and everything is working fine so far. But there is one question, for which I couldn't find an answer yet: When having more time steps than units, how does the process within a LSTM-layer looks like?
I am using keras in R for modelling temperature. This is the architecture:
model <- keras_model_sequential() %>%
layer_lstm(units = 30, input_shape = c(timesteps = 60, features = 2)) %>%
layer_dense(units = 1)
Upvotes: 1
Views: 339
Reputation: 720
Actually LSTM blocks process one time step at one time. The units
argument is actually the dimensionality of the output space. So it basically has nothing to do with the size of time steps.
More specifically, the input and output of LSTM or RNN should look like this:
(timestep, input_dim) -> LSTM -> (timestep, output_dim)
However, the return_sequences
argument is default to be False
(in Keras Python, not sure with R). So the LSTM layer will return the last time step state as output by default. This is why you can connect it to the dense layer.
Upvotes: 1