TensorBoard标量图中“平滑”参数背后的数学是什么?

问题描述 投票:10回答:2

我认为它是某种移动平均线,但有效范围在0到1之间。

tensorflow tensorboard
2个回答
13
投票

平滑解释here和应用here。它是一个线性滤波器。


26
投票

@ 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
© www.soinside.com 2019 - 2024. All rights reserved.