本文介绍了“平滑"背后的数学原理是什么?TensorBoard 标量图中的参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我认为它是某种移动平均线,但有效范围在 0 到 1 之间.
I presume it is some kind of moving average, but the valid range is between 0 and 1.
推荐答案
它叫做指数移动平均线,下面是代码解释它是如何创建的.
It is called exponential moving average, below is a code explanation how it is created.
假设所有实数标量值都在一个名为scalars
的列表中,平滑应用如下:
Assuming all the real scalar values are in a list called scalars
the smoothing is applied as follows:
def smooth(scalars: List[float], weight: float) -> List[float]: # 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
这篇关于“平滑"背后的数学原理是什么?TensorBoard 标量图中的参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!