MCPcopy Create free account
hub / github.com/DragonisCV/RAM / smooth_data

Function smooth_data

ram/utils/plot_util.py:68–83  ·  view source on GitHub ↗

Smooth data using 1st-order IIR low-pass filter (what tensorflow does). Reference: https://github.com/tensorflow/tensorboard/blob/f801ebf1f9fbfe2baee1ddd65714d0bccc640fb1/tensorboard/plugins/scalar/vz_line_chart/vz-line-chart.ts#L704 # noqa: E501 Args: values (list): A list of va

(values, smooth_weight)

Source from the content-addressed store, hash-verified

66
67
68def smooth_data(values, smooth_weight):
69 """ Smooth data using 1st-order IIR low-pass filter (what tensorflow does).
70
71 Reference: https://github.com/tensorflow/tensorboard/blob/f801ebf1f9fbfe2baee1ddd65714d0bccc640fb1/tensorboard/plugins/scalar/vz_line_chart/vz-line-chart.ts#L704 # noqa: E501
72
73 Args:
74 values (list): A list of values to be smoothed.
75 smooth_weight (float): Smooth weight.
76 """
77 values_sm = []
78 last_sm_value = values[0]
79 for value in values:
80 value_sm = last_sm_value * smooth_weight + (1 - smooth_weight) * value
81 values_sm.append(value_sm)
82 last_sm_value = value_sm
83 return values_sm

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected