import math


def decayed_rate(decay_type, decay_rate, learning_rate_init, step):
	"""
	Calculate decayed learning rate for specified parameters
	Returns: Scalar decayed learning rate
	"""

	if decay_type == 'none':
		return learning_rate_init
	elif decay_type == 'exp':
		return learning_rate_init*math.pow(decay_rate,step)
	elif decay_type == 'inv_time':
		return learning_rate_init/(1+decay_rate*step)
	elif decay_type == 'nat_exp':
		return learning_rate_init*math.exp(-decay_rate*step)