fitbenchmarking.results_processing.performance_profiler module

Set up performance profiles for both accuracy and runtime tables

class fitbenchmarking.results_processing.performance_profiler.DashPerfProfile(profile_name, pp_df, group_label)

Bases: object

General class for creating performance profiles.

create_graph(x_axis_scale, solvers)

Creates the dash plot.

Parameters:
  • x_axis_scale (str) – Can be either “Log x-axis” or “Linear x-axis”

  • solvers (list[str]) – The solvers to show in the graph

Returns:

Figure for the Dash plot

Return type:

plotly.graph_objects.Figure

layout()

Creates and returns the dash plot for the performance profile, which is used in fitbenchmarking/core/results_output, in the function “display_page”.

Returns:

Dash plot for the performance profile.

Return type:

dcc.Graph

prepare_data(solvers)

Prepares data for plotting performance profiles in Dash.

Parameters:

solvers (list[str]) – Solvers to be selected, max 15

Returns:

Performance profile data

Return type:

pandas.DataFrame

set_callbacks()

Calls callbacks on the function that creates the dash graph.

update_linestyles(solvers) None

Determines a combination of linestyle and color for each solver.

Parameters:

solvers (list[str]) – Solvers to be selected, max 15

fitbenchmarking.results_processing.performance_profiler.adjust_values_to_plot(step_values: list[ndarray], solvers: list[str]) dict[str, list]

Prepares the values to plot and deals with failures.

Parameters:
  • step_values (list[np.array[float]]) – Sorted values of the metric being profiled

  • solvers (list[str]) – The solvers to be plotted

Returns:

Data to plot

Return type:

dict[str, list]

fitbenchmarking.results_processing.performance_profiler.compute_linestyle_combinations() list[tuple[str, str]]

Compute combinations of linestyles and colours to be used in performance profile plots.

Returns:

The combinations of linestyles and colours

Return type:

list[tuple[str, str]]

fitbenchmarking.results_processing.performance_profiler.compute_step_values(profile_plot)

Computes the step values for plotting performance profiles.

Parameters:

profile_plot (dict[str, list[float]]) – data related to the metric being profiled

Returns:

acc or runtime or emissions values to plot, maximum x value

Return type:

list[np.arrays(float)], float

fitbenchmarking.results_processing.performance_profiler.create_df(solvers: list[str], labels: list[str], solver_values: list[ndarray], plot_points: list[ndarray]) DataFrame

Creates a pandas dataframe with performance profile data, which Dash uses to plot the profiles.

Parameters:
  • solvers (list[str]) – The names of the solvers

  • labels (list[str]) – The labels for the solvers (showing n failures)

  • solver_values (list[np.array[float]]) – The solver values (x values) for each solver

  • plot_points (list[np.array[float]]) – The y values for each solver

Returns:

Performance profile data

Return type:

pandas.DataFrame

fitbenchmarking.results_processing.performance_profiler.create_plot(step_values: list[ndarray], solvers: list[str]) Figure

Function to draw plot in plotly.

Parameters:
  • step_values (list[np.array[float]]) – Sorted values of the metric being profiled

  • solvers (list[str]) – The solvers to be plotted

Returns:

The perfomance profile graph

Return type:

plotly.graph_objects.Figure

fitbenchmarking.results_processing.performance_profiler.create_plots_and_get_paths(bounds, fig_dir, options)

Function that generates profiler plots

Parameters:
  • bounds (dict[str, dict[str, list[float]]]) – For each metric, a dictionary of solver names and the list of values (one for each problem)

  • fig_dir (str) – path to directory containing the figures

  • options (utils.options.Options) – The options for the run

Returns:

path to profile graphs for each metric

Return type:

dict[str, str]

fitbenchmarking.results_processing.performance_profiler.prepare_profile_data(results)

Helper function which generates dictionaries for each metric containing names of solvers as the keys and a list of floats (one for each problem) as the values.

Parameters:

results (dict[str, dict[str, list[utils.fitbm_result.FittingResult]]]) – The sorted results grouped by row and category

Returns:

dictionary containing number of occurrences

Return type:

dict[str, dict[str, list[float]]]

fitbenchmarking.results_processing.performance_profiler.profile(results, fig_dir, options)

Function that generates profiler plots

Parameters:
Returns:

Path to performance profile graphs, data for plotting the performance profiles

Return type:

dict[str, str], dict[str, pandas.DataFrame]

fitbenchmarking.results_processing.performance_profiler.update_fig(fig: Figure, name: str, use_log_plot: bool, log_upper_limit: int) Figure

Update layout of plotly (or Dash) plot.

Parameters:
  • fig (plotly.graph_objects.Figure) – The performance profile plot

  • name (str) – The name of the graph

  • use_log_plot (boolean) – Whether to use a log x axis or not

  • log_upper_limit (int) – The upper limit for the x axis (when log)

Returns:

Updated plot

Return type:

plotly.graph_objects.Figure