I have a BiLSTM model, as the following:
tf.keras.models.Sequential([
tf.keras.layers.Bidirectional(tf.keras.layers.LSTM(A, return_sequences=True),
input_shape=x),
tf.keras.layers.Dense(B, activation='tanh'),
tf.keras.layers.Bidirectional(tf.keras.layers.LSTM(A)),
tf.keras.layers.Dense(B, activation='tanh'),
tf.keras.layers.Dropout(0.25),
tf.keras.layers.Dense(output),
])
If the total parameters = 1 million, what values should A and B be? How many hidden layers should I add to let the model train in a proper way?
I tried the following:
A = 265
B = 64
I used three dense layers, but the forecasting is still weak!
The LSTM layer is long-short-term memory. It can process input as sequences. You do not need to chop the input into small pieces.
Sample: A single shape and double sharp. You can apply BiDirection or a domain property as well. I use this example as a single trip because of its dimension.
Operation: ( 10, 1, 1 ) x ( 10, 1, 1 )
Output: (10, 10)
Operation: ( 20, 1, 1 ) x ( 10, 1, 1 )
Output: (20, 10)
Operation: ( 30, 1, 1 ) x ( 10, 1, 1 )
Output: (30, 10)
Operation: ( 30, 1, 1 ) x ( 10, 1, 1 )
Output: (30, 20)
Sample: Implementation, Discrete sequence
Output: As a sequence