我认为它是某种移动平均线,但有效范围在0到1之间。
@ drpng的答案指向了正确的解释,但由于链接可能在这里下去,因此使用的平滑函数的Pythonic转换代码。
假设所有实数标量值都在名为scalars
的列表中,则应用如下平滑:
def smooth(scalars, weight): # Weight between 0 and 1
last = scalars[0] # First value in the plot (first timestep)
smoothed = list()
for point in scalars:
smoothed_val = last * weight + (1 - weight) * point # Calculate smoothed value
smoothed.append(smoothed_val) # Save it
last = smoothed_val # Anchor the last smoothed value
return smoothed