能否手动调用 tensorboard 平滑函数?

2024-09-30 01:21:23 发布

您现在位置:Python中文网/ 问答频道 /正文

我有两个数组X和Y

有没有一个函数可以调用tensorboard来实现平滑?在

现在我可以在python中使用另一种方法,比如: sav_smoooth = savgol_filter(Y, 51, 3) plt.plot(X, Y) 但我不确定张力索板是怎么变光滑的。有我可以调用的函数吗?在

谢谢。在


Tags: 方法函数plotplt数组filtersavtensorboard
1条回答
网友
1楼 · 发布于 2024-09-30 01:21:23

到目前为止,我还没有找到手动调用它的方法,但是你可以构造一个类似的函数

基于这个answer,函数将类似于

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

相关问题 更多 >

    热门问题