1

Is it possible to downloaded the smooth values generated from Tensorboard or at least get the smoothing function to be able to generate the same graphics as in Tensorboard.

  • did you see this? https://stackoverflow.com/questions/42011419/is-it-possible-to-call-tensorboard-smooth-function-manually – Charlie Parker Sep 27 '21 at 20:45
  • Does this answer your question? [What is the mathematics behind the "smoothing" parameter in TensorBoard's scalar graphs?](https://stackoverflow.com/questions/42281844/what-is-the-mathematics-behind-the-smoothing-parameter-in-tensorboards-scalar) – Charlie Parker Sep 27 '21 at 20:51

3 Answers3

1

It has changed a bit recently, but currently TensorBoard does exponential averaging for its smoothing. Should be quite easy to re-implement.

Allen Lavoie
  • 5,778
  • 1
  • 17
  • 26
0

rate = 0.1 # range of 0.0 for no smoothing, 1.0 for overly perfect smoothing.

def ema(old:float, new:float, rate:float)->float: return old * rate + new * (1.0 - rate)

ema(10, 9, 0.1)

Yaoshiang
  • 1,713
  • 5
  • 15
0

they use some type of exp weighted avg. Try:

def my_tb_smooth(scalars: list[float], weight: float) -> list[float]:  # Weight between 0 and 1
    """

    ref: https://stackoverflow.com/questions/42011419/is-it-possible-to-call-tensorboard-smooth-function-manually

    :param scalars:
    :param weight:
    :return:
    """
    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

credit: Is it possible to call tensorboard smooth function manually?

Charlie Parker
  • 5,884
  • 57
  • 198
  • 323