Reputation: 69
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.
Upvotes: 1
Views: 1367
Reputation: 5201
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?
Upvotes: 0
Reputation: 1941
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)
Upvotes: 0
Reputation: 5808
It has changed a bit recently, but currently TensorBoard does exponential averaging for its smoothing. Should be quite easy to re-implement.
Upvotes: 1