ctlearn_optimizer.auxiliar_functions

Module Contents

ctlearn_optimizer.auxiliar_functions.plot_convergence(*args, **kwargs)[source]

Plot one or several convergence traces.

Parameters
  • args[i] (OptimizeResult, list of OptimizeResult, or tuple) – The result(s) for which to plot the convergence trace.

    • if OptimizeResult, then draw the corresponding single trace;

    • if list of OptimizeResult, then draw the corresponding convergence traces in transparency, along with the average convergence trace;

    • if tuple, then args[i][0] should be a string label and args[i][1] an OptimizeResult or a list of OptimizeResult.

  • ax (Axes, optional) – The matplotlib axes on which to draw the plot, or None to create a new one.

  • yscale (None or string, optional) – The scale for the y-axis.

Returns

Axes – The matplotlib axes.

ctlearn_optimizer.auxiliar_functions.df2result(df, metric_col, param_cols, param_types=None)[source]

Convert df with metrics and hyperparams to the OptimizeResults format.

It is a helper function that lets you use all the tools that expect OptimizeResult object like for example scikit-optimize plot_evaluations function.

Parameters
  • df (pandas.DataFrame) – Dataframe containing metric and hyperparameters.

  • metric_col (str) – Name of the metric column.

  • param_cols (list) – Names of the hyperparameter columns.

  • param_types (list or None) – Optional list of hyperparameter column types. By default it will treat all the columns as float but you can also pass str for categorical channels. Example: param_types=[float, str, float, float]

Returns

scipy.optimize.OptimizeResult – Results object that contains the hyperparameter and metric information.