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

前端 未结 1 1540
你的背包
你的背包 2021-01-01 11:55

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

相关标签:
1条回答
  • 2021-01-01 12:40

    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
    
    0 讨论(0)
提交回复
热议问题