-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from autonomio/master
updating dev from master
- Loading branch information
Showing
3 changed files
with
121 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,27 @@ | ||
from keras.optimizers import SGD, Adam, Adadelta, Adagrad, Adamax, RMSprop, Nadam | ||
from keras.optimizers import SGD, Adam, Adadelta, Adagrad, Adamax, RMSprop | ||
from keras.optimizers import Nadam | ||
|
||
|
||
def lr_normalizer(lr, optimizer): | ||
"""Assuming a default learning rate 1, rescales the learning rate | ||
such that learning rates amongst different optimizers are more or less | ||
equivalent. | ||
'''NORMALIZE LEARNING RATE ON DEFAULT 1''' | ||
Parameters | ||
---------- | ||
lr : float | ||
The learning rate. | ||
optimizer : keras optimizer | ||
The optimizer. For example, Adagrad, Adam, RMSprop. | ||
""" | ||
|
||
if optimizer == Adadelta: | ||
lr = lr | ||
elif optimizer == SGD: | ||
lr = lr / 100 | ||
elif optimizer == Adam: | ||
lr = lr / 1000 | ||
elif optimizer == Adagrad: | ||
lr = lr / 100 | ||
elif optimizer == Adamax: | ||
lr = lr / 500 | ||
elif optimizer == RMSprop: | ||
lr = lr / 1000 | ||
elif optimizer == Nadam: | ||
lr = lr / 500 | ||
pass | ||
elif optimizer == SGD or optimizer == Adagrad: | ||
lr /= 100.0 | ||
elif optimizer == Adam or optimizer == RMSprop: | ||
lr /= 1000.0 | ||
elif optimizer == Adamax or optimizer == Nadam: | ||
lr /= 500.0 | ||
|
||
return lr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters