Skip to content

Commit 5b6bbd3

Browse files
Add combined results and plot generation (#219)
* Add an option --combined-results to create list with all use cases * Add options to draw comparison plots * Handle n_jobs param correctly and add Summary 2 and All cases 2 pages * Add footnote for plot and add metrics * Update footnote * Update docs * Code format * Address comments
1 parent f903e7f commit 5b6bbd3

5 files changed

Lines changed: 588 additions & 1 deletion

File tree

sklbench/report/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ Raw results are converted into a pandas dataframe and the final report is made b
1818
| `--report-file` | str | report.xlsx | | Report file path. |
1919
| `--report-type` | str | separate-tables | ('separate-tables',) | Report type ("separate-tables" is the only supported now). |
2020
| `--compatibility-mode` | | False | | [EXPERIMENTAL] Compatibility mode drops and modifies results to make them comparable (for example, sklearn and cuML parameters). |
21+
| `--performance-stability-metrics`</br>`-psm` | | False | | Adds performance stability metrics (`1st run time[ms]`, `1st-mean run ratio`, `median time[ms]`, `time CV`) to the report. |
22+
| `--combined-results` | | False | | [EXPERIMENTAL] Creates `All cases` and `Summary (for plots)` sheets combining time and speedup of all algorithms with per-dtype/total GEOMEAN rows (use with `--compatibility-mode`). |
23+
| `--draw-plots` | | False | | [EXPERIMENTAL] Draws Training/Inference speedup bar charts from the combined results (requires `--combined-results`). Footnote hardware parameters are hardcoded; edit them in the code for a production-ready plot. |
24+
| `--plot-output` | str | `plot.png` | | [EXPERIMENTAL] Output file path for plots (e.g. `plots.png`); if unset, plots are saved to `plot.png`. Only takes effect together with `--draw-plots`. |
2125
| `--drop-columns`</br>`--drop-cols` | str | [] | | Columns to drop from report. |
2226
| `--diff-columns`</br>`--diff-cols` | str | ['environment_name', 'library', 'format', 'device'] | | Columns to show difference between. |
2327
| `--split-columns` | str | ['estimator', 'method', 'function'] | | Splitting columns for subreports/sheets. |

sklbench/report/arguments.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,28 @@ def add_report_generator_arguments(
9393
help="Selects which part of one-vs-one difference to show "
9494
"(all matrix or one of triangles).",
9595
)
96+
parser.add_argument(
97+
"--combined-results",
98+
default=False,
99+
action="store_true",
100+
help="[EXPERIMENTAL] Creates 'All cases' and 'Summary (for plots)' sheets "
101+
"combining time[ms] and speedup of all algorithms into single pages with "
102+
"per-dtype and total GEOMEAN rows. Use together with --compatibility-mode.",
103+
)
104+
parser.add_argument(
105+
"--draw-plots",
106+
default=False,
107+
action="store_true",
108+
help="[EXPERIMENTAL] Draw Training/Inference speedup bar charts from combined "
109+
"results (requires --combined-results).",
110+
)
111+
parser.add_argument(
112+
"--plot-output",
113+
type=str,
114+
default="plot.png",
115+
help="[EXPERIMENTAL] Output file path for plots (e.g., plots.png). "
116+
"If not specified, plots are saved to plot.png.",
117+
)
96118
# color scale settings
97119
parser.add_argument(
98120
"--perf-color-scale",

sklbench/report/compatibility.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ def transform_results_to_compatible(results: pd.DataFrame):
3434
"min_bin_size",
3535
],
3636
)
37+
if (
38+
"n_jobs" in results.columns
39+
and results["n_jobs"].isna().any()
40+
and results["n_jobs"].notna().any()
41+
):
42+
results.drop(inplace=True, columns=["n_jobs"])
3743
if results["environment_name"].unique().size > 1:
3844
# DBSCAN `eps` parameter drop for different CPUs
3945
results.drop(

0 commit comments

Comments
 (0)