Kaixiang Lin
Kaixiang Lin

Reputation: 229

Is it possible to call tensorboard smooth function manually?

I have two arrays X and Y.

Is there a function I can call in tensorboard to do the smooth?

Right now I can do an alternative way in python like: sav_smoooth = savgol_filter(Y, 51, 3) plt.plot(X, Y) But I am not sure what's way tensorboard do smooth. Is there a function I can call?

Thanks.

Upvotes: 5

Views: 1245

Answers (1)

Mike W
Mike W

Reputation: 1403

So far I haven't found a way to call it manually, but you can construct a similar function,

based on this answer, the function will be something like

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

Upvotes: 2

Related Questions