Home

Published

- 1 min read

keras callbacks learning rate scheduler

img of keras callbacks learning rate scheduler

The solution for this is noted below

keras callbacks learning rate scheduler

Solution

   def scheduler(epoch, lr):
	if epoch < 10:
		return lr
	else:
		return lr * tf.math.exp(-0.1)
callback = tf.keras.callbacks.LearningRateScheduler(scheduler)
model.fit(np.arange(100).reshape(5, 20), np.zeros(5),
	epochs=15, callbacks=[callback], verbose=0)

Try other methods by searching on the site. That is if this doesn’t work