Skip to content

Add combined results and plot generation - #219

Open
avolkov-intel wants to merge 8 commits into
IntelPython:mainfrom
avolkov-intel:dev/anatolyv-combined-results
Open

Add combined results and plot generation#219
avolkov-intel wants to merge 8 commits into
IntelPython:mainfrom
avolkov-intel:dev/anatolyv-combined-results

Conversation

@avolkov-intel

@avolkov-intel avolkov-intel commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Description

New CLI options

  • --combined-results — builds two extra sheets:
    • All cases — all algorithm results on one page (group name, sklearn time[ms], sklearnex time[ms], speedup, then parameters). KNN is split into
      brute/kd_tree; rows sorted by dtype then dataset; each group ends with per-dtype and total GEOMEAN formula rows with a per-group speedup color scale.
    • Summary (for plots) — one row per algorithm referencing the group GEOMEAN cells (total + fp32 + fp64), split into Training/Inference sections with
      section and total geomeans.
  • --draw-plots / --plot-output <path> — renders a Training/Inference speedup bar chart (geomean per algorithm, combining fp32 & fp64) with
    Intel-branded titles and disclaimer footnote.

Other changes

  • --performance-stability-metrics now additionally emits a median time[ms] column (alongside existing 1st run time[ms], time CV), included in the
    individual sheets and "All cases".

Use --compatibility-mode together with --combined-results so sklearn/sklearnex rows merge correctly.

Completeness and readability

  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation to reflect the changes or created a separate PR with updates and provided its number in the description, if necessary.
  • Git commit message contains an appropriate signed-off-by string (see CONTRIBUTING.md for details).
  • I have resolved any merge conflicts that might occur with the base branch.

Testing

  • I have run it locally and tested the changes extensively.
  • All CI jobs are green or I have provided justification why they aren't.
  • I have extended testing suite if new functionality was introduced in this PR.

@david-cortes-intel

Copy link
Copy Markdown
Contributor

@avolkov-intel Please document these options in the .md files where the other options are described.

@avolkov-intel
avolkov-intel force-pushed the dev/anatolyv-combined-results branch from ceda047 to 1886459 Compare August 17, 2026 11:11
@avolkov-intel

Copy link
Copy Markdown
Collaborator Author

@avolkov-intel Please document these options in the .md files where the other options are described.

Done

@avolkov-intel

Copy link
Copy Markdown
Collaborator Author

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()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potentially yes, but this would make the code more complex and we don't need it right now

Comment thread sklbench/report/README.md
| `--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. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this require passing --draw-plots?

@avolkov-intel avolkov-intel Aug 18, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well technically no, you can provide it without draw plots it would be just ignored

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add that kind of detail in these docs.

@david-cortes-intel

Copy link
Copy Markdown
Contributor

@avolkov-intel Would this work when comparing against cuml? If so, how would it handle cases where parameters do not match?

Comment thread sklbench/report/README.md
| `--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`). |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@david-cortes-intel

Copy link
Copy Markdown
Contributor

@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):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make row a parameter.

return df


def write_all_cases_2_sheet(dfs, wb):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about LocalOutlierFactor and NearestNeighbors?

if c in gdf.columns
]
if sort_cols:
gdf = gdf.sort_values(sort_cols, kind="mergesort")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please switch it to parameter.

new_ws.append([None])


def draw_summary_plots(all_cases_df: pd.DataFrame, output_file: str = None):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be helpful to have a sub-function to generate the plot returning matplotlib objects (plt, fig, axes).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants