I am trying to reproduce polynomial decay for learning rate decay in Keras framework which as implemented in Tensorflow framework is given below.
def poly_decay(step, initial_value, decay_period_images_seen):
"""
Decays a variable using a polynomial law.
:param step: number of images seen by the network since the beginning of the training.
:param initial_value: The initial value of the variable to decay..
:param decay_period_images_seen: the decay period in terms of images seen by the network
(1 epoch of 10 batches of 6 images each means that 1 epoch = 60 images seen).
Thus this value must be a multiple of the number of batches
:return: The decayed variable.
"""
factor = 1.0 - (tf.cast(step, tf.float32) / float(decay_period_images_seen))
lrate = initial_value * np.power(factor, 0.9)
return lrate
Does Keras offer any hidden parameter (which perhaps I don't know about) for global step or is there an equivalent of global step in Keras? Or is there any alternative way to implement polynomial learning rate decay in Keras framework ?