bayeso.utils.utils_covariance¶
It is utilities for covariance functions.
-
bayeso.utils.utils_covariance.
_get_list_first
() → list¶ It provides list of strings. The strings in that list require two hyperparameters, signal and lengthscales. We simply call it as list_first.
Returns: list of strings, which satisfy some requirements we mentioned above. Return type: list
-
bayeso.utils.utils_covariance.
convert_hyps
(str_cov: str, hyps: dict, fix_noise: bool = False) → numpy.ndarray¶ It converts hyperparameters dictionary, hyps to numpy array.
Parameters: - str_cov (str.) – the name of covariance function.
- hyps (dict.) – dictionary of hyperparameters for covariance function.
- fix_noise (bool., optional) – flag for fixing a noise.
Returns: converted array of the hyperparameters given by hyps.
Return type: numpy.ndarray
Raises: AssertionError
-
bayeso.utils.utils_covariance.
get_hyps
(str_cov: str, dim: int, use_ard: bool = True) → dict¶ It returns a dictionary of default hyperparameters for covariance function, where str_cov and dim are given. If use_ard is True, the length scales would be dim-dimensional vector.
Parameters: - str_cov (str.) – the name of covariance function.
- dim (int.) – dimensionality of the problem we are solving.
- use_ard (bool., optional) – flag for automatic relevance determination.
Returns: dictionary of default hyperparameters for covariance function.
Return type: dict.
Raises: AssertionError
-
bayeso.utils.utils_covariance.
get_range_hyps
(str_cov: str, dim: int, use_ard: bool = True, fix_noise: bool = False) → list¶ It returns default optimization ranges of hyperparameters for Gaussian process regression.
Parameters: - str_cov (str.) – the name of covariance function.
- dim (int.) – dimensionality of the problem we are solving.
- use_ard (bool., optional) – flag for automatic relevance determination.
- fix_noise (bool., optional) – flag for fixing a noise.
Returns: list of default optimization ranges for hyperparameters.
Return type: list
Raises: AssertionError
-
bayeso.utils.utils_covariance.
restore_hyps
(str_cov: str, hyps: numpy.ndarray, fix_noise: bool = False, noise: float = 0.01) → dict¶ It restores hyperparameters array, hyps to dictionary.
Parameters: - str_cov (str.) – the name of covariance function.
- hyps (numpy.ndarray) – array of hyperparameters for covariance function.
- fix_noise (bool., optional) – flag for fixing a noise.
- noise (float, optional) – fixed noise value.
Returns: restored dictionary of the hyperparameters given by hyps.
Return type: dict.
Raises: AssertionError
-
bayeso.utils.utils_covariance.
validate_hyps_arr
(hyps: numpy.ndarray, str_cov: str, dim: int) → Tuple[numpy.ndarray, bool]¶ It validates hyperparameters array, hyps.
Parameters: - hyps (numpy.ndarray) – array of hyperparameters for covariance function.
- str_cov (str.) – the name of covariance function.
- dim (int.) – dimensionality of the problem we are solving.
Returns: a tuple of valid hyperparameters and validity flag.
Return type: (numpy.ndarray, bool.)
Raises: AssertionError
-
bayeso.utils.utils_covariance.
validate_hyps_dict
(hyps: dict, str_cov: str, dim: int) → Tuple[dict, bool]¶ It validates hyperparameters dictionary, hyps.
Parameters: - hyps (dict.) – dictionary of hyperparameters for covariance function.
- str_cov (str.) – the name of covariance function.
- dim (int.) – dimensionality of the problem we are solving.
Returns: a tuple of valid hyperparameters and validity flag.
Return type: (dict., bool.)
Raises: AssertionError