MCPcopy Create free account
hub / github.com/huggingface/evaluate / _scale_data

Method _scale_data

src/evaluate/visualization.py:116–125  ·  view source on GitHub ↗

Scales data[1:] to ranges[0]

(self, data, ranges)

Source from the content-addressed store, hash-verified

114 self.ax.tick_params(axis="both", pad=self.format_cfg["theta_tick_lbls_pad"])
115
116 def _scale_data(self, data, ranges):
117 """Scales data[1:] to ranges[0]"""
118 for d, (y1, y2) in zip(data[1:], ranges[1:]):
119 assert (y1 <= d <= y2) or (y2 <= d <= y1)
120 x1, x2 = ranges[0]
121 d = data[0]
122 sdata = [d]
123 for d, (y1, y2) in zip(data[1:], ranges[1:]):
124 sdata.append((d - y1) / (y2 - y1) * (x2 - x1) + x1)
125 return sdata
126
127 def plot(self, data, *args, **kwargs):
128 """Plots a line"""

Callers 1

plotMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected