bayeso.utils.utils_plotting

bayeso.utils.utils_plotting._save_figure(path_save, str_postfix, str_prefix='')

It saves a figure.

Parameters:
  • path_save (str.) – path for saving a figure.
  • str_postfix (str.) – the name of postfix.
  • str_prefix (str., optional) – the name of prefix.
Returns:

None.

Return type:

NoneType

bayeso.utils.utils_plotting._set_ax_config(ax, str_x_axis, str_y_axis, size_labels=32, size_ticks=22, xlim_min=None, xlim_max=None, is_box=True, is_zero_axis=False, is_grid=True)

It sets an axis configuration.

Parameters:
  • ax (matplotlib.axes._subplots.AxesSubplot) – inputs for acquisition function. Shape: (n, d).
  • str_x_axis (str.) – the name of x axis.
  • str_y_axis (str.) – the name of y axis.
  • size_labels (int., optional) – label size.
  • size_ticks (int., optional) – tick size.
  • xlim_min (NoneType or float, optional) – None, or minimum for x limit.
  • xlim_max (NoneType or float, optional) – None, or maximum for x limit.
  • is_box (bool., optional) – flag for drawing a box.
  • is_zero_axis (bool., optional) – flag for drawing a zero axis.
  • is_grid (bool., optional) – flag for drawing grids.
Returns:

None.

Return type:

NoneType

bayeso.utils.utils_plotting._set_font_config(is_tex)

It sets a font configuration.

Parameters:is_tex (bool.) – flag for using latex.
Returns:None.
Return type:NoneType
bayeso.utils.utils_plotting._show_figure(is_pause, time_pause)

It shows a figure.

Parameters:
  • is_pause (bool.) – flag for pausing before closing a figure.
  • time_pause (float) – pausing time.
Returns:

None.

Return type:

NoneType

bayeso.utils.utils_plotting.plot_bo_step(X_train, Y_train, X_test, Y_test, mean_test, std_test, path_save=None, str_postfix=None, str_x_axis='x', str_y_axis='y', int_init=None, is_tex=False, is_zero_axis=False, is_pause=True, time_pause=2.0, range_shade=1.96)

It is for plotting Bayesian optimization results step by step.

Parameters:
  • X_train (numpy.ndarray) – training inputs. Shape: (n, 1).
  • Y_train (numpy.ndarray) – training outputs. Shape: (n, 1).
  • X_test (numpy.ndarray) – test inputs. Shape: (m, 1).
  • Y_test (NoneType or numpy.ndarray, optional) – None, or true test outputs. Shape: (m, 1).
  • mean_test (numpy.ndarray) – posterior predictive mean function values over X_test. Shape: (m, 1).
  • std_test (numpy.ndarray) – posterior predictive standard deviation function values over X_test. Shape: (m, 1).
  • path_save (NoneType or str., optional) – None, or path for saving a figure.
  • str_postfix (NoneType or str., optional) – None, or the name of postfix.
  • str_x_axis (str., optional) – the name of x axis.
  • str_y_axis (str., optional) – the name of y axis.
  • int_init (NoneType or int., optional) – None, or the number of initial examples.
  • is_tex (bool., optional) – flag for using latex.
  • is_zero_axis (bool., optional) – flag for drawing a zero axis.
  • is_pause (bool., optional) – flag for pausing before closing a figure.
  • time_pause (float, optional) – pausing time.
  • range_shade (float, optional) – shade range for standard deviation.
Returns:

None.

Return type:

NoneType

Raises:

AssertionError

bayeso.utils.utils_plotting.plot_bo_step_acq(X_train, Y_train, X_test, Y_test, mean_test, std_test, acq_test, path_save=None, str_postfix=None, str_x_axis='x', str_y_axis='y', str_acq_axis='acq.', int_init=None, is_tex=False, is_zero_axis=False, is_pause=True, time_pause=2.0, range_shade=1.96)

It is for plotting Bayesian optimization results step by step.

Parameters:
  • X_train (numpy.ndarray) – training inputs. Shape: (n, 1).
  • Y_train (numpy.ndarray) – training outputs. Shape: (n, 1).
  • X_test (numpy.ndarray) – test inputs. Shape: (m, 1).
  • Y_test (NoneType or numpy.ndarray, optional) – None, or true test outputs. Shape: (m, 1).
  • mean_test (numpy.ndarray) – posterior predictive mean function values over X_test. Shape: (m, 1).
  • std_test (numpy.ndarray) – posterior predictive standard deviation function values over X_test. Shape: (m, 1).
  • acq_test (numpy.ndarray) – acquisition funcion values over X_test. Shape: (m, 1).
  • path_save (NoneType or str., optional) – None, or path for saving a figure.
  • str_postfix (NoneType or str., optional) – None, or the name of postfix.
  • str_x_axis (str., optional) – the name of x axis.
  • str_y_axis (str., optional) – the name of y axis.
  • str_acq_axis (str., optional) – the name of acquisition function axis.
  • int_init (NoneType or int., optional) – None, or the number of initial examples.
  • is_tex (bool., optional) – flag for using latex.
  • is_zero_axis (bool., optional) – flag for drawing a zero axis.
  • is_pause (bool., optional) – flag for pausing before closing a figure.
  • time_pause (float, optional) – pausing time.
  • range_shade (float, optional) – shade range for standard deviation.
Returns:

None.

Return type:

NoneType

Raises:

AssertionError

bayeso.utils.utils_plotting.plot_gp(X_train, Y_train, X_test, mu, sigma, Y_test_truth=None, path_save=None, str_postfix=None, str_x_axis='x', str_y_axis='y', is_tex=False, is_zero_axis=False, is_pause=True, time_pause=2.0, range_shade=1.96, colors=['red', 'green', 'blue', 'orange', 'olive', 'purple', 'darkred', 'limegreen', 'deepskyblue', 'lightsalmon', 'aquamarine', 'navy', 'rosybrown', 'darkkhaki', 'darkslategray'])

It is for plotting Gaussian process regression.

Parameters:
  • X_train (numpy.ndarray) – training inputs. Shape: (n, 1).
  • Y_train (numpy.ndarray) – training outputs. Shape: (n, 1).
  • X_test (numpy.ndarray) – test inputs. Shape: (m, 1).
  • mu (numpy.ndarray) – posterior predictive mean function values over X_test. Shape: (m, 1).
  • sigma (numpy.ndarray) – posterior predictive standard deviation function values over X_test. Shape: (m, 1).
  • Y_test_truth (NoneType or numpy.ndarray, optional) – None, or true test outputs. Shape: (m, 1).
  • path_save (NoneType or str., optional) – None, or path for saving a figure.
  • str_postfix (NoneType or str., optional) – None, or the name of postfix.
  • str_x_axis (str., optional) – the name of x axis.
  • str_y_axis (str., optional) – the name of y axis.
  • is_tex (bool., optional) – flag for using latex.
  • is_zero_axis (bool., optional) – flag for drawing a zero axis.
  • is_pause (bool., optional) – flag for pausing before closing a figure.
  • time_pause (float, optional) – pausing time.
  • range_shade (float, optional) – shade range for standard deviation.
  • colors (list, optional) – list of colors.
Returns:

None.

Return type:

NoneType

Raises:

AssertionError

bayeso.utils.utils_plotting.plot_gp_sampled(X, Ys, path_save=None, str_postfix=None, str_x_axis='x', str_y_axis='y', is_tex=False, is_zero_axis=False, is_pause=True, time_pause=2.0, colors=['red', 'green', 'blue', 'orange', 'olive', 'purple', 'darkred', 'limegreen', 'deepskyblue', 'lightsalmon', 'aquamarine', 'navy', 'rosybrown', 'darkkhaki', 'darkslategray'])

It is for plotting sampled functions from multivariate distributions.

Parameters:
  • X (numpy.ndarray) – training inputs. Shape: (n, 1).
  • Ys (numpy.ndarray) – training outputs. Shape: (m, n).
  • path_save (NoneType or str., optional) – None, or path for saving a figure.
  • str_postfix (NoneType or str., optional) – None, or the name of postfix.
  • str_x_axis (str., optional) – the name of x axis.
  • str_y_axis (str., optional) – the name of y axis.
  • is_tex (bool., optional) – flag for using latex.
  • is_zero_axis (bool., optional) – flag for drawing a zero axis.
  • is_pause (bool., optional) – flag for pausing before closing a figure.
  • time_pause (float, optional) – pausing time.
  • colors (list, optional) – list of colors.
Returns:

None.

Return type:

NoneType

Raises:

AssertionError

bayeso.utils.utils_plotting.plot_minimum(arr_minima, list_str_label, int_init, is_std, is_marker=True, is_legend=False, is_tex=False, path_save=None, str_postfix=None, str_x_axis='Iteration', str_y_axis='Minimum function value', is_pause=True, time_pause=2.0, range_shade=1.96, markers=['.', 'x', '*', '+', '^', 'v', '<', '>', 'd', ',', '8', 'h', '1', '2', '3'], colors=['red', 'green', 'blue', 'orange', 'olive', 'purple', 'darkred', 'limegreen', 'deepskyblue', 'lightsalmon', 'aquamarine', 'navy', 'rosybrown', 'darkkhaki', 'darkslategray'])

It is for plotting optimization results of Bayesian optimization, in terms of iterations.

Parameters:
  • arr_minima (numpy.ndarray) – function values over acquired examples. Shape: (b, r, n) where b is the number of experiments, r is the number of rounds, and n is the number of iterations per round.
  • list_str_label (list) – list of label strings. Shape: (b, ).
  • int_init (int.) – the number of initial examples < n.
  • is_std (bool.) – flag for drawing standard deviations.
  • is_marker (bool., optional) – flag for drawing markers.
  • is_legend (bool., optional) – flag for drawing a legend.
  • is_tex (bool., optional) – flag for using latex.
  • path_save (NoneType or str., optional) – None, or path for saving a figure.
  • str_postfix (NoneType or str., optional) – None, or the name of postfix.
  • str_x_axis (str., optional) – the name of x axis.
  • str_y_axis (str., optional) – the name of y axis.
  • is_pause (bool., optional) – flag for pausing before closing a figure.
  • time_pause (float, optional) – pausing time.
  • range_shade (float, optional) – shade range for standard deviation.
  • markers (list, optional) – list of markers.
  • colors (list, optional) – list of colors.
Returns:

None.

Return type:

NoneType

Raises:

AssertionError

bayeso.utils.utils_plotting.plot_minimum_time(arr_times, arr_minima, list_str_label, int_init, is_std, is_marker=True, is_legend=False, is_tex=False, path_save=None, str_postfix=None, str_x_axis='Time (sec.)', str_y_axis='Minimum function value', is_pause=True, time_pause=2.0, range_shade=1.96, markers=['.', 'x', '*', '+', '^', 'v', '<', '>', 'd', ',', '8', 'h', '1', '2', '3'], colors=['red', 'green', 'blue', 'orange', 'olive', 'purple', 'darkred', 'limegreen', 'deepskyblue', 'lightsalmon', 'aquamarine', 'navy', 'rosybrown', 'darkkhaki', 'darkslategray'])

It is for plotting optimization results of Bayesian optimization, in terms of execution time.

Parameters:
  • arr_times (numpy.ndarray) – execution times. Shape: (b, r, n), or (b, r, int_init + n) where b is the number of experiments, r is the number of rounds, and n is the number of iterations per round.
  • arr_minima (numpy.ndarray) – function values over acquired examples. Shape: (b, r, int_init + n) where b is the number of experiments, r is the number of rounds, and n is the number of iterations per round.
  • list_str_label (list) – list of label strings. Shape: (b, ).
  • int_init (int.) – the number of initial examples.
  • is_std (bool.) – flag for drawing standard deviations.
  • is_marker (bool., optional) – flag for drawing markers.
  • is_legend (bool., optional) – flag for drawing a legend.
  • is_tex (bool., optional) – flag for using latex.
  • path_save (NoneType or str., optional) – None, or path for saving a figure.
  • str_postfix (NoneType or str., optional) – None, or the name of postfix.
  • str_x_axis (str., optional) – the name of x axis.
  • str_y_axis (str., optional) – the name of y axis.
  • is_pause (bool., optional) – flag for pausing before closing a figure.
  • time_pause (float, optional) – pausing time.
  • range_shade (float, optional) – shade range for standard deviation.
  • markers (list, optional) – list of markers.
  • colors (list, optional) – list of colors.
Returns:

None.

Return type:

NoneType

Raises:

AssertionError