Add combined results and plot generation - #219
Conversation
|
@avolkov-intel Please document these options in the .md files where the other options are described. |
ceda047 to
1886459
Compare
Done |
|
CI failures are not related to this PR |
| if ( | ||
| "n_jobs" in results.columns | ||
| and results["n_jobs"].isna().any() | ||
| and results["n_jobs"].notna().any() |
There was a problem hiding this comment.
Would it make more sense to drop and results["n_jobs"].notna().any() and just drop n_jobs col if any are na? Or what is the reason for this change
There was a problem hiding this comment.
If we compare sklearn algorithm with sklearnex counterpart, n_jobs parameter might only be present in sklearnex but not in sklearn. In this case the measurements will not be compared and report & plots would not be generated. So the idea of this change if both not nans and nans are present we can drop this column so that reports are properly generated. If all values are na there's no need to drop the column
There was a problem hiding this comment.
This feature should only be used for comparison of sklearn vs sklearnex btw
| Each block ends with per-dtype and total GEOMEAN formula rows plus a speedup color scale. | ||
| Returns list of (group_name, total_geomean_row, {dtype: geomean_row}) for the summary sheet. | ||
| """ | ||
| KNN = ("KNeighborsClassifier", "KNeighborsRegressor") |
There was a problem hiding this comment.
Is there a way to make this knn-specific logic more flexible? ie right now we have 2 different knn methods but what it we wanted to use 2 different LogReg solvers - would we need to keep adding in algo-specific logic or can we set it up to be more general?
There was a problem hiding this comment.
Potentially yes, but this would make the code more complex and we don't need it right now
| | `--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. | | ||
| | `--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`). | | ||
| | `--draw-plots` | | False | | [EXPERIMENTAL] Draws Training/Inference speedup bar charts from the combined results (requires `--combined-results`). | | ||
| | `--plot-output` | str | None | | [EXPERIMENTAL] Output file path for plots (e.g. `plots.png`); if unset, plots are shown interactively. | |
There was a problem hiding this comment.
Does this require passing --draw-plots?
There was a problem hiding this comment.
Well technically no, you can provide it without draw plots it would be just ignored
There was a problem hiding this comment.
Please add that kind of detail in these docs.
|
@avolkov-intel Would this work when comparing against cuml? If so, how would it handle cases where parameters do not match? |
| | `--compatibility-mode` | | False | | [EXPERIMENTAL] Compatibility mode drops and modifies results to make them comparable (for example, sklearn and cuML parameters). | | ||
| | `--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. | | ||
| | `--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`). | | ||
| | `--draw-plots` | | False | | [EXPERIMENTAL] Draws Training/Inference speedup bar charts from the combined results (requires `--combined-results`). | |
There was a problem hiding this comment.
This option without --plot-output doesn't appear to do anything. It doesn't show anything interactive for me, or at least not when used in an SSH session.
|
@avolkov-intel Please add information about how to generate a publication-grade plot, with details in the bottom text filled in. |
| ws = wb.create_sheet(title="All cases", index=1) | ||
| row, geomean_rows = 1, [] | ||
|
|
||
| def geomean_row(label, r0, r1): |
There was a problem hiding this comment.
Please make row a parameter.
| return df | ||
|
|
||
|
|
||
| def write_all_cases_2_sheet(dfs, wb): |
There was a problem hiding this comment.
Please add a description of what wb is. Better yet if you can add type hints.
| Each block ends with per-dtype and total GEOMEAN formula rows plus a speedup color scale. | ||
| Returns list of (group_name, total_geomean_row, {dtype: geomean_row}) for the summary sheet. | ||
| """ | ||
| KNN = ("KNeighborsClassifier", "KNeighborsRegressor") |
There was a problem hiding this comment.
What about LocalOutlierFactor and NearestNeighbors?
| if c in gdf.columns | ||
| ] | ||
| if sort_cols: | ||
| gdf = gdf.sort_values(sort_cols, kind="mergesort") |
There was a problem hiding this comment.
Is this trying to do a stable sort? Otherwise, why pass the parameter?
| j = i | ||
| while j + 1 < len(dtypes) and dtypes[j + 1] == dtypes[i]: | ||
| j += 1 | ||
| dtype_rows[dtypes[i]] = geomean_row( |
There was a problem hiding this comment.
Since this one doesn't embed geomean as a formula, maybe the code could be a lot more readable if this were to pre-generate subtables as dataframes and store them in a list to write at the end.
| return [f"={src_sheet_name}!{c}{row_num}" for c in "BCD"] | ||
|
|
||
| def write_section(title, rows): | ||
| nonlocal current_row |
There was a problem hiding this comment.
Please switch it to parameter.
| new_ws.append([None]) | ||
|
|
||
|
|
||
| def draw_summary_plots(all_cases_df: pd.DataFrame, output_file: str = None): |
There was a problem hiding this comment.
Would be helpful to have a sub-function to generate the plot returning matplotlib objects (plt, fig, axes).
Description
New CLI options
--combined-results— builds two extra sheets:brute/kd_tree; rows sorted by dtype then dataset; each group ends with per-dtype and total
GEOMEANformula rows with a per-group speedup color scale.section and total geomeans.
--draw-plots/--plot-output <path>— renders a Training/Inference speedup bar chart (geomean per algorithm, combining fp32 & fp64) withIntel-branded titles and disclaimer footnote.
Other changes
--performance-stability-metricsnow additionally emits amedian time[ms]column (alongside existing1st run time[ms],time CV), included in theindividual sheets and "All cases".
Use
--compatibility-modetogether with--combined-resultsso sklearn/sklearnex rows merge correctly.Completeness and readability
Testing