Decrease learning rate with scheduled patience of early stooping

575 views
Skip to first unread message

Omar

unread,
May 4, 2016, 6:26:43 AM5/4/16
to Keras-users
I want the patience of early stopping to modify the learning rate.

so I have:

keras.callbacks.EarlyStopping(monitor='val_loss', patience=10, verbose=0, mode='auto')


when patience is 5 I would like the learning rate to be divided by 10.

The callback to modify the learning rate takes only an epoch as input:


keras.callbacks.LearningRateScheduler(schedule)


which is not very helpful realistic.


Is there any way to modify the learning rate schedule taking into consideration certain amount of patience?#

Thank you!


Tomasz Melcer

unread,
May 6, 2016, 9:50:42 AM5/6/16
to Omar, Keras-users
On 05/04/2016 12:26 PM, Omar wrote:
> Is there any way to modify the learning rate schedule taking into
> consideration certain amount of patience?#

Sure, but not with the default callbacks. You need to write your own
callback class that will perform learning rate adjustments following
whatever rules you plan to implement. Follow the manual [1] and use
`LearningRateScheduler` [2] and `EarlyStopping` [3] callbacks' source
code as examples of how to implement patience value and set learning
rate inside a callback.

[1] http://keras.io/callbacks/#create-a-callback
[2]
https://github.com/fchollet/keras/blob/f576f37801af6760931ca0de094535fc884181cb/keras/callbacks.py#L389
[3]
https://github.com/fchollet/keras/blob/f576f37801af6760931ca0de094535fc884181cb/keras/callbacks.py#L301


--
Tomasz Melcer

rob...@gmail.com

unread,
May 11, 2016, 1:29:13 PM5/11/16
to Keras-users
http://pastebin.com/rJkUdRAz Just in case you haven't write it already too :)

Omar

unread,
May 13, 2016, 9:58:06 AM5/13/16
to Keras-users, rob...@gmail.com
Thank you Rob!
Reply all
Reply to author
Forward
0 new messages