2

I see in some question/answers that ask to decrease the learning rate. But I don't know how can I see and change the learning rate of LSTM model in Keras library?

Shayan Shafiq
  • 1,008
  • 4
  • 13
  • 24
user3486308
  • 1,310
  • 5
  • 19
  • 29

1 Answers1

3

In Keras, you can set the learning rate as a parameter for the optimization method, the piece of code below is an example from Keras documentation:

    from keras import optimizers

model = Sequential() model.add(Dense(64, kernel_initializer='uniform', input_shape=(10,))) model.add(Activation('softmax'))

sgd = optimizers.SGD(lr=0.01, decay=1e-6, momentum=0.9, nesterov=True) model.compile(loss='mean_squared_error', optimizer=sgd)

In the above code, the fifth line lr is learning rate, which in this code is set to 0.01. You change it to whatever you want.

For further detail, see this link.

Please tell me if this helped to solve your problem.

Shayan Shafiq
  • 1,008
  • 4
  • 13
  • 24
Hunar
  • 1,197
  • 2
  • 11
  • 33