What is the mathematics behind the “smoothing” parameter in TensorBoard's scalar graphs?

假装没事ソ 提交于 2019-12-21 03:24:10

问题


I presume it is some kind of moving average, but the valid range is between 0 and 1.


回答1:


It is called exponential moving average, below is a code explanation how it is created.

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


来源:https://stackoverflow.com/questions/42281844/what-is-the-mathematics-behind-the-smoothing-parameter-in-tensorboards-scalar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!