MCPcopy
hub / github.com/GPflow/GPflow / time_line

Function time_line

benchmark/plotters.py:97–146  ·  view source on GitHub ↗

Creates a plot of performance over time.

(
    ax: Axes,
    file_key: Tuple[str, ...],
    column_key: Tuple[str, ...],
    row_key: Tuple[str, ...],
    line_by: GroupingSpec,
    metrics_df: pd.DataFrame,
    metadata: Collection[BenchmarkMetadata],
)

Source from the content-addressed store, hash-verified

95
96@make_plotter
97def time_line(
98 ax: Axes,
99 file_key: Tuple[str, ...],
100 column_key: Tuple[str, ...],
101 row_key: Tuple[str, ...],
102 line_by: GroupingSpec,
103 metrics_df: pd.DataFrame,
104 metadata: Collection[BenchmarkMetadata],
105) -> None:
106 """
107 Creates a plot of performance over time.
108 """
109 assert GroupingKey.PLOTTER not in line_by.by
110 metric = _get_metric(metrics_df)
111 line_by = replace(line_by, by=[k for k in line_by.by if k != GroupingKey.TIMESTAMP])
112 line_groups = group(metrics_df, [], metadata, line_by)
113 for key, df, _ in line_groups:
114 line_xs = []
115 line_y_means = []
116 line_y_uppers = []
117 line_y_lowers = []
118
119 scatter_xs = []
120 scatter_ys = []
121
122 timestamp_by = GroupingSpec([GroupingKey.TIMESTAMP], minimise=False)
123 timestamp_groups = group(df, [], metadata, timestamp_by)
124 for (timestamp,), timestamp_df, _ in timestamp_groups:
125 parsed_timestamp = date2num(parse_timestamp(timestamp))
126 line_xs.append(parsed_timestamp)
127 y_mean = timestamp_df.value.mean()
128 y_std = timestamp_df.value.std()
129 if isnan(y_std):
130 y_std = 0.0
131 line_y_means.append(y_mean)
132 line_y_uppers.append(y_mean + 1.96 * y_std)
133 line_y_lowers.append(y_mean - 1.96 * y_std)
134
135 scatter_xs.extend(len(timestamp_df) * [parsed_timestamp])
136 scatter_ys.extend(timestamp_df.value)
137
138 (mean_line,) = ax.plot(line_xs, line_y_means, label=_join_key(key))
139 color = mean_line.get_color()
140 ax.fill_between(line_xs, line_y_lowers, line_y_uppers, color=color, alpha=0.3)
141 ax.scatter(scatter_xs, scatter_ys, color=color)
142
143 if len(line_groups) > 1:
144 ax.legend()
145
146 _shared_ax_config(ax, file_key, column_key, row_key, metric)

Callers

nothing calls this directly

Calls 7

groupFunction · 0.90
GroupingSpecClass · 0.90
parse_timestampFunction · 0.90
_get_metricFunction · 0.85
_join_keyFunction · 0.85
_shared_ax_configFunction · 0.85
plotMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…