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
到目前为止,我还没有找到手动调用它的方法,但是你可以构造一个类似的函数
基于这个answer,函数将类似于
相关问题 更多 >
编程相关推荐