LSTM-DNN network Architecture

41 views
Skip to first unread message

hiran.park

unread,
Nov 27, 2024, 9:02:32 AM11/27/24
to Keras-users
Hi 
Is there someone to explain architecture  below source

def build_lstm_dnn_model(lstm_input_shape, dnn_input_shape):
    # LSTM branch
    lstm_input = Input(shape=lstm_input_shape, name="lstm_input")
    lstm_out = LSTM(64, return_sequences=True)(lstm_input)
    lstm_out = LSTM(64)(lstm_out)
    lstm_out = Dropout(0.3)(lstm_out)

    # DNN branch
    dnn_input = Input(shape=dnn_input_shape, name="dnn_input")
    dnn_out = Dense(128, activation='relu')(dnn_input)
    dnn_out = Dropout(0.3)(dnn_out)
    dnn_out = Dense(64, activation='relu')(dnn_out)

    # Combine LSTM and DNN branches
    combined = Concatenate()([lstm_out, dnn_out])
    combined_out = Dense(32, activation='relu')(combined)
    final_output = Dense(1, activation='sigmoid', name='output')(combined_out)


    # Define the model
    model = Model(inputs=[lstm_input, dnn_input], outputs=final_output)
    model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])
    return model


I want to know network architecture  and explain  please

Samer Attrah

unread,
Nov 27, 2024, 9:38:51 AM11/27/24
to Keras-users
Hello,

I would like to answer your question, this model is a two-branch model one is made of LSTM layers and the second is made of Dense layers. and in each branch, there is a single dropout layer.
and then the two layers are concatenated and the single vector is inputted into two dense layers.

Please check the attachment and if you need more details let me know the specific part that you are looking to understand.

Kind regards
model_diagram.pdf

Denis Dal Soler

unread,
Nov 27, 2024, 11:13:12 AM11/27/24
to Samer Attrah, Keras-users
Dear Samer
as usual I found your flowchart very clear.
Can you please exploding the connection between;
  •  the single lstm units inside the first lstm(64)  block.
  •  the two first lstm blocks (c(t) and h(t))
  •  an ipotetic  vector input (x1,x2,...., xn) with the   first lstm block.
Thanks
Denis

--
You received this message because you are subscribed to the Google Groups "Keras-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to keras-users...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/keras-users/68b79029-4848-4963-8a90-f18693d2872dn%40googlegroups.com.


--
Reply all
Reply to author
Forward
0 new messages