0

So this is the part of the code of a deep learning model which I am building using keras function API. Can You Please tell me how to decide Number of Units in each layer.

input_text_layer = Input(shape=(34,),name="Input_sequence)

e1 = Embedding(input_dim=40000, output_dim=no_of_output_dim, input_length=34)(input_text_layer)

lstm_layer = LSTM(no_of_lstm_units, dropout=0.2, return_sequences=True)(e1)

flatten_layer = Flatten()(lstm_layer)
...some dense layers...

How to decide the values of no_of_output_dim in the Embedding layer and no_of_lstm_units given that all other values which are hard coded are constant.

Asis
  • 183
  • 3
  • 15
  • I think this has been answered before: https://stackoverflow.com/questions/44273249/in-keras-what-exactly-am-i-configuring-when-i-create-a-stateful-lstm-layer-wi – A. Kojen Dec 24 '19 at 22:57
  • I still don't understand that is ```no_of_lstm_units``` depends upon ```no_of_output_dim``` and ```input_length``` both? – Asis Dec 24 '19 at 23:14
  • These are hyperparameters that are tuned using something like Grid Search, basically you try a bunch of parameters and keep the best performing ones. – Dr. Snoopy Dec 25 '19 at 01:34

0 Answers0