Exponential Moving Average
目的:使得参数变化更加顺滑
设原参数为
param_updates = [0.1, 0.2, -0.1, 0.3, -0.2]
使用ema进行变换
param_ema = 0
alpha = 0.9
for param in params:
param_ema = alpha * param_ema + (1 - alpha) * param
print(param_ema)
结果为
[0.009999999999999998, 0.028999999999999998, 0.0161, 0.04448999999999999, 0.020040999999999996]