bayeso.utils.utils_common
It is utilities for common features.
- bayeso.utils.utils_common.get_grids(ranges: ndarray, num_grids: int) ndarray
It returns grids of given ranges, where each of dimension has num_grids partitions.
- Parameters:
ranges (numpy.ndarray) – ranges. Shape: (d, 2).
num_grids (int.) – the number of partitions per dimension.
- Returns:
grids of given ranges. Shape: (num_grids\(^{\text{d}}\), d).
- Return type:
numpy.ndarray
- Raises:
AssertionError
- bayeso.utils.utils_common.get_minimum(Y_all: ndarray, num_init: int) Tuple[ndarray, ndarray, ndarray]
It returns accumulated minima at each iteration, their arithmetic means over rounds, and their standard deviations over rounds, which is widely used in Bayesian optimization community.
- Parameters:
Y_all (numpy.ndarray) – historical function values. Shape: (r, t) where r is the number of Bayesian optimization rounds and t is the number of iterations including initial points for each round. For example, if we run 50 iterations with 5 initial examples and repeat this procedure 3 times, r would be 3 and t would be 55 (= 50 + 5).
num_init (int.) – the number of initial points.
- Returns:
tuple of accumulated minima, their arithmetic means over rounds, and their standard deviations over rounds. Shape: ((r, t - num_init + 1), (t - num_init + 1, ), (t - num_init + 1, )).
- Return type:
(numpy.ndarray, numpy.ndarray, numpy.ndarray)
- Raises:
AssertionError
- bayeso.utils.utils_common.get_time(time_all: ndarray, num_init: int, include_init: bool) ndarray
It returns the means of accumulated execution times over rounds.
- Parameters:
time_all (numpy.ndarray) – execution times for all Bayesian optimization rounds. Shape: (r, t) where r is the number of Bayesian optimization rounds and t is the number of iterations (including initial points if include_init is True, or excluding them if include_init is False) for each round.
num_init (int.) – the number of initial points. If include_init is False, it is ignored even if it is provided.
include_init (bool.) – flag for describing whether execution times to observe initial examples have been included or not.
- Returns:
arithmetic means of accumulated execution times over rounds. Shape: (t - num_init, ) if include_init is True. (t, ), otherwise.
- Return type:
numpy.ndarray
- Raises:
AssertionError
- bayeso.utils.utils_common.validate_types(func: Callable) Callable
It is a decorator for validating the number of types, which are declared for typing.
- Parameters:
func (callable) – an original function.
- Returns:
a callable decorator.
- Return type:
callable
- Raises:
AssertionError