optilab.plotting package
Submodules
optilab.plotting.box_plot module
Plotting optimization results with box plot.
- plot_box_plot(data: Dict[str, List[float]], savepath: str | None = None, *, show: bool = True, function_name: str | None = None, hide_outliers: bool = False) None[source]
Plot box plots of optimization results.
- Parameters:
data – dictionary where keys are optimization method or function names and values are list of best values from each run.
savepath – Path to save the plot, optional.
show – Wheather to show the plot, default True.
function_name – Name of the optimized function, used in title.
hide_outliers – If true, outliers won’t be shown on the box plot. Defualt is False.
optilab.plotting.convergence_curve module
Calculating and plotting the convergence curve.
- convergence_curve(log: PointList) List[float][source]
For a given log return a convergence curve - the lowest value achieved so far.
- Parameters:
log – Results log - the values of errors of the optimized function.
- Returns:
y values of the convergence curve.
- plot_convergence_curve(data: Dict[str, List[PointList]], savepath: str | None = None, *, show: bool = True, function_name: str | None = None) None[source]
Plot the convergence curves of a few methods using pyplot.
- Parameters:
data – Lists of error logs of a few methods expressed as {method name: [log]}.
savepath – Path to save the plot, optional.
show – Wheather to show the plot, default True.
function_name – Name of the optimized function, used in title.
optilab.plotting.ecdf_curve module
Plotting and calculating ECDF curves.
- _ecdf_thresholding(log: List[float], thresholds: List[float], n_dimensions: int, extend_to_len: int | None = None) Tuple[List[float], List[float]][source]
Perform thresholding of a log with a given list of thresholds. The resulting y is the number of thresholds achieved by the log items.
- Parameters:
log – Error log of a optimization function.
thresholds – ECDF value thresholds.
n_dimensions – Dimensionality of optimized function.
- Returns:
x and y values for the curve.
- ecdf_curve(data: Dict[str, List[PointList]], n_dimensions: int, allowed_error: float, n_thresholds: int = 100) Dict[str, Tuple[List[float], List[float]]][source]
Calculate ECDF curves.
- Parameters:
data – Lists of value logs indexed by method name.
n_dimensions – Dimensionality of the solved problem.
allowed_error – Tolerable error value, used as the last threshold.
n_thresholds – Number of ECDF thresholds.
- Returns:
x, y plot points for each method.
- plot_ecdf_curves(data: Dict[str, PointList], n_dimensions: int, allowed_error: float, n_thresholds: int = 100, savepath: str | None = None, *, show: bool = True, function_name: str | None = None) None[source]
Calculate and plot ECDF curves.
- Parameters:
data – Lists of value logs for every method.
n_dimensions – Dimensionality of the optimized function.
allowed_error – Tolerable error value, used as the last threshold.
n_thresholds – Number of ECDF thresholds.
savepath – Path to save the plot, optional.
show – Wheather to show the plot, default True.
function_name – Name of the optimized function, used in title.
Module contents
Module optilab.plotting . Contains functions to plot results.