bayeso.utils.utils_plotting¶
It is utilities for plotting figures.
-
bayeso.utils.utils_plotting.
_save_figure
(path_save: str, str_postfix: str, str_prefix: str = '') → None¶ 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: matplotlib.axes._subplots.AxesSubplot, str_x_axis: str, str_y_axis: str, size_labels: int = 32, size_ticks: int = 22, xlim_min: Optional[float] = None, xlim_max: Optional[float] = None, draw_box: bool = True, draw_zero_axis: bool = False, draw_grid: bool = True) → None¶ 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.
- draw_box (bool., optional) – flag for drawing a box.
- draw_zero_axis (bool., optional) – flag for drawing a zero axis.
- draw_grid (bool., optional) – flag for drawing grids.
Returns: None.
Return type: NoneType
-
bayeso.utils.utils_plotting.
_set_font_config
(use_tex: bool) → None¶ It sets a font configuration.
Parameters: use_tex (bool.) – flag for using latex. Returns: None. Return type: NoneType
-
bayeso.utils.utils_plotting.
_show_figure
(pause_figure: bool, time_pause: Union[int, float]) → None¶ It shows a figure.
Parameters: - pause_figure (bool.) – flag for pausing before closing a figure.
- time_pause (int. or float) – pausing time.
Returns: None.
Return type: NoneType
-
bayeso.utils.utils_plotting.
plot_bo_step
(X_train: numpy.ndarray, Y_train: numpy.ndarray, X_test: numpy.ndarray, Y_test: numpy.ndarray, mean_test: numpy.ndarray, std_test: numpy.ndarray, path_save: Optional[str] = None, str_postfix: Optional[str] = None, str_x_axis: str = 'x', str_y_axis: str = 'y', num_init: Optional[int] = None, use_tex: bool = False, draw_zero_axis: bool = False, pause_figure: bool = True, time_pause: Union[int, float] = 2.0, range_shade: float = 1.96) → None¶ 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 (numpy.ndarray) – 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.
- num_init (NoneType or int., optional) – None, or the number of initial examples.
- use_tex (bool., optional) – flag for using latex.
- draw_zero_axis (bool., optional) – flag for drawing a zero axis.
- pause_figure (bool., optional) – flag for pausing before closing a figure.
- time_pause (int. or 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_with_acq
(X_train: numpy.ndarray, Y_train: numpy.ndarray, X_test: numpy.ndarray, Y_test: numpy.ndarray, mean_test: numpy.ndarray, std_test: numpy.ndarray, acq_test: numpy.ndarray, path_save: Optional[str] = None, str_postfix: Optional[str] = None, str_x_axis: str = 'x', str_y_axis: str = 'y', str_acq_axis: str = 'acq.', num_init: Optional[int] = None, use_tex: bool = False, draw_zero_axis: bool = False, pause_figure: bool = True, time_pause: Union[int, float] = 2.0, range_shade: float = 1.96) → None¶ 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 (numpy.ndarray) – 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.
- num_init (NoneType or int., optional) – None, or the number of initial examples.
- use_tex (bool., optional) – flag for using latex.
- draw_zero_axis (bool., optional) – flag for drawing a zero axis.
- pause_figure (bool., optional) – flag for pausing before closing a figure.
- time_pause (int. or 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_via_distribution
(X_train: numpy.ndarray, Y_train: numpy.ndarray, X_test: numpy.ndarray, mean_test: numpy.ndarray, std_test: numpy.ndarray, Y_test: Optional[numpy.ndarray] = None, path_save: Optional[str] = None, str_postfix: Optional[str] = None, str_x_axis: str = 'x', str_y_axis: str = 'y', use_tex: bool = False, draw_zero_axis: bool = False, pause_figure: bool = True, time_pause: Union[int, float] = 2.0, range_shade: float = 1.96, colors: numpy.ndarray = array(['red', 'green', 'blue', 'orange', 'olive', 'purple', 'darkred', 'limegreen', 'deepskyblue', 'lightsalmon', 'aquamarine', 'navy', 'rosybrown', 'darkkhaki', 'darkslategray'], dtype='<U13')) → None¶ 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).
- 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).
- Y_test (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.
- use_tex (bool., optional) – flag for using latex.
- draw_zero_axis (bool., optional) – flag for drawing a zero axis.
- pause_figure (bool., optional) – flag for pausing before closing a figure.
- time_pause (int. or float, optional) – pausing time.
- range_shade (float, optional) – shade range for standard deviation.
- colors (np.ndarray, optional) – array of colors.
Returns: None.
Return type: NoneType
Raises: AssertionError
-
bayeso.utils.utils_plotting.
plot_gp_via_sample
(X: numpy.ndarray, Ys: numpy.ndarray, path_save: Optional[str] = None, str_postfix: Optional[str] = None, str_x_axis: str = 'x', str_y_axis: str = 'y', use_tex: bool = False, draw_zero_axis: bool = False, pause_figure: bool = True, time_pause: Union[int, float] = 2.0, colors: numpy.ndarray = array(['red', 'green', 'blue', 'orange', 'olive', 'purple', 'darkred', 'limegreen', 'deepskyblue', 'lightsalmon', 'aquamarine', 'navy', 'rosybrown', 'darkkhaki', 'darkslategray'], dtype='<U13')) → None¶ 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.
- use_tex (bool., optional) – flag for using latex.
- draw_zero_axis (bool., optional) – flag for drawing a zero axis.
- pause_figure (bool., optional) – flag for pausing before closing a figure.
- time_pause (int. or float, optional) – pausing time.
- colors (np.ndarray, optional) – array of colors.
Returns: None.
Return type: NoneType
Raises: AssertionError
-
bayeso.utils.utils_plotting.
plot_minimum_vs_iter
(minima: numpy.ndarray, list_str_label: List[str], num_init: int, draw_std: bool, include_marker: bool = True, include_legend: bool = False, use_tex: bool = False, path_save: Optional[str] = None, str_postfix: Optional[str] = None, str_x_axis: str = 'Iteration', str_y_axis: str = 'Minimum function value', pause_figure: bool = True, time_pause: Union[int, float] = 2.0, range_shade: float = 1.96, markers: numpy.ndarray = array(['.', 'x', '*', '+', '^', 'v', '<', '>', 'd', ',', '8', 'h', '1', '2', '3'], dtype='<U1'), colors: numpy.ndarray = array(['red', 'green', 'blue', 'orange', 'olive', 'purple', 'darkred', 'limegreen', 'deepskyblue', 'lightsalmon', 'aquamarine', 'navy', 'rosybrown', 'darkkhaki', 'darkslategray'], dtype='<U13')) → None¶ It is for plotting optimization results of Bayesian optimization, in terms of iterations.
Parameters: - 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, ).
- num_init (int.) – the number of initial examples < n.
- draw_std (bool.) – flag for drawing standard deviations.
- include_marker (bool., optional) – flag for drawing markers.
- include_legend (bool., optional) – flag for drawing a legend.
- use_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.
- pause_figure (bool., optional) – flag for pausing before closing a figure.
- time_pause (int. or float, optional) – pausing time.
- range_shade (float, optional) – shade range for standard deviation.
- markers (np.ndarray, optional) – array of markers.
- colors (np.ndarray, optional) – array of colors.
Returns: None.
Return type: NoneType
Raises: AssertionError
-
bayeso.utils.utils_plotting.
plot_minimum_vs_time
(times: numpy.ndarray, minima: numpy.ndarray, list_str_label: List[str], num_init: int, draw_std: bool, include_marker: bool = True, include_legend: bool = False, use_tex: bool = False, path_save: Optional[str] = None, str_postfix: Optional[str] = None, str_x_axis: str = 'Time (sec.)', str_y_axis: str = 'Minimum function value', pause_figure: bool = True, time_pause: Union[int, float] = 2.0, range_shade: float = 1.96, markers: numpy.ndarray = array(['.', 'x', '*', '+', '^', 'v', '<', '>', 'd', ',', '8', 'h', '1', '2', '3'], dtype='<U1'), colors: numpy.ndarray = array(['red', 'green', 'blue', 'orange', 'olive', 'purple', 'darkred', 'limegreen', 'deepskyblue', 'lightsalmon', 'aquamarine', 'navy', 'rosybrown', 'darkkhaki', 'darkslategray'], dtype='<U13')) → None¶ It is for plotting optimization results of Bayesian optimization, in terms of execution time.
Parameters: - times (numpy.ndarray) – execution times. Shape: (b, r, n), or (b, r, num_init + n) where b is the number of experiments, r is the number of rounds, and n is the number of iterations per round.
- minima (numpy.ndarray) – function values over acquired examples. Shape: (b, r, num_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, ).
- num_init (int.) – the number of initial examples.
- draw_std (bool.) – flag for drawing standard deviations.
- include_marker (bool., optional) – flag for drawing markers.
- include_legend (bool., optional) – flag for drawing a legend.
- use_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.
- pause_figure (bool., optional) – flag for pausing before closing a figure.
- time_pause (int. or float, optional) – pausing time.
- range_shade (float, optional) – shade range for standard deviation.
- markers (np.ndarray, optional) – array of markers.
- colors (np.ndarray, optional) – array of colors.
Returns: None.
Return type: NoneType
Raises: AssertionError