'What is the from repeating same layers in AI architecture
I know that in ai models lstm is used to extract features from data and dropout is used to focus in the main ones, but i can't understand why people used to repeat the layers multiple times like those 3 layers (lstm dropout Batchnormalization) are repeated 3 times so what if i just put lstm dropout Batchnormalization and then dense??? Can any one explain what's the benefits of repeating them while the same features will be extracted as i think.
def buildModel(self,x_train):
model = Sequential()
x = len(x_train[0])
model.add(LSTM(256,input_shape=((1,x)), return_sequences = True, activation = "relu"))
model.add(Dropout(0.2))
model.add(BatchNormalization())
model.add(LSTM(128, input_shape=((1, x)), return_sequences=True, activation="relu"))
model.add(Dropout(0.2))
model.add(BatchNormalization())
model.add(LSTM(128, input_shape=((1, x)), activation="relu"))
model.add(Dropout(0.2))
model.add(BatchNormalization())
model.add(Dense(32, activation="relu"))
model.add(Dropout(0.2))
model.add(Dense(2, activation="softmax"))
optimizer = tf.keras.optimizers.Adam(lr = 0.001, decay = 1e-6)
model.compile(loss="sparse_categorical_crossentropy",optimizer=optimizer)
return model
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|