bayeso.gp.gp_common¶
It defines functions for Gaussian process regression.
-
bayeso.gp.gp_common.
get_kernel_cholesky
(X_train: numpy.ndarray, hyps: dict, str_cov: str, fix_noise: bool = True, use_gradient: bool = False, debug: bool = False) → Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray]¶ This function computes a kernel inverse with Cholesky decomposition.
Parameters: - X_train (numpy.ndarray) – inputs. Shape: (n, d) or (n, m, d).
- hyps (dict.) – dictionary of hyperparameters for Gaussian process.
- str_cov (str.) – the name of covariance function.
- fix_noise (bool., optional) – flag for fixing a noise.
- use_gradient (bool., optional) – flag for computing and returning gradients of negative log marginal likelihood.
- debug (bool., optional) – flag for printing log messages.
Returns: a tuple of kernel matrix over X_train, lower matrix computed by Cholesky decomposition, and gradients of kernel matrix. If use_gradient is False, gradients of kernel matrix would be None.
Return type: tuple of (numpy.ndarray, numpy.ndarray, numpy.ndarray)
Raises: AssertionError
-
bayeso.gp.gp_common.
get_kernel_inverse
(X_train: numpy.ndarray, hyps: dict, str_cov: str, fix_noise: bool = True, use_gradient: bool = False, debug: bool = False) → Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray]¶ This function computes a kernel inverse without any matrix decomposition techniques.
Parameters: - X_train (numpy.ndarray) – inputs. Shape: (n, d) or (n, m, d).
- hyps (dict.) – dictionary of hyperparameters for Gaussian process.
- str_cov (str.) – the name of covariance function.
- fix_noise (bool., optional) – flag for fixing a noise.
- use_gradient (bool., optional) – flag for computing and returning gradients of negative log marginal likelihood.
- debug (bool., optional) – flag for printing log messages.
Returns: a tuple of kernel matrix over X_train, kernel matrix inverse, and gradients of kernel matrix. If use_gradient is False, gradients of kernel matrix would be None.
Return type: tuple of (numpy.ndarray, numpy.ndarray, numpy.ndarray)
Raises: AssertionError