(
df: pd.DataFrame, results_dir: Path, imgs_dir: Path, fmms_name: str, fmt: str = "png"
)
| 175 | concurrencies = sorted(all_x) |
| 176 | ax.set_xlabel("Batch Size") |
| 177 | ax.set_ylabel(ylabel) |
| 178 | ax.set_xscale("log") |
| 179 | ax.set_xticks(concurrencies, labels=[int(x) for x in concurrencies], minor=False) |
| 180 | ax.set_xticks([], minor=True) |
| 181 | if hline is not None: |
| 182 | ax.axhline(hline, color="black", linewidth=0.8, linestyle="--") |
| 183 | ax.grid(alpha=0.5) |
| 184 | |
| 185 | |
| 186 | # --------------------------------------------------------------------------- |
| 187 | # Per-model TPOT plots (imgs/tpots/) |
| 188 | # --------------------------------------------------------------------------- |
| 189 | |
| 190 | |
| 191 | def plot_tpots( |
| 192 | df: pd.DataFrame, results_dir: Path, imgs_dir: Path, fmms_name: str, fmt: str = "png" |
| 193 | ): |
| 194 | tpots_dir = imgs_dir / "tpots" |
| 195 | tp = tp_from_dir(results_dir) |
| 196 | |
| 197 | for model in MODELS: |
| 198 | mdf = df.query("model == @model") |
| 199 | if mdf.empty: |
| 200 | continue |
| 201 | |
| 202 | tpots_dir.mkdir(parents=True, exist_ok=True) |
| 203 | fig, ax = plt.subplots(figsize=TPOT_FIGSIZE) |
| 204 | series = [] |
| 205 | for variant in [BASELINE_NAME, FI2_NAME, fmms_name]: |
| 206 | vdf = mdf.query("variant == @variant") |
| 207 | if not vdf.empty: |
| 208 | series.append((variant, vdf.rename(columns={"median_tpot_ms": "y"}))) |
| 209 | _plot_scatter_line( |
| 210 | ax, series=series, x_col="max_concurrency", y_col="y", ylabel="Median TPOT (ms)" |
| 211 | ) |
| 212 | ax.set_title(f"{model} TP{tp}") |
| 213 | ax.legend(title="Method") |
| 214 | ax.annotate( |
| 215 | "lower is better", |
| 216 | xy=(0.98, 0.02), |
| 217 | xycoords="axes fraction", |
| 218 | ha="right", |
no test coverage detected