bayeso.gp.gp_likelihood

It defines the functions related to likelihood for Gaussian process regression.

bayeso.gp.gp_likelihood.neg_log_ml(X_train: numpy.ndarray, Y_train: numpy.ndarray, hyps: numpy.ndarray, str_cov: str, prior_mu_train: numpy.ndarray, use_ard: bool = True, fix_noise: bool = True, use_cholesky: bool = True, use_gradient: bool = True, debug: bool = False) → Union[float, Tuple[float, numpy.ndarray]]

This function computes a negative log marginal likelihood.

Parameters:
  • X_train (numpy.ndarray) – inputs. Shape: (n, d) or (n, m, d).
  • Y_train (numpy.ndarray) – outputs. Shape: (n, 1).
  • hyps (numpy.ndarray) – hyperparameters for Gaussian process. Shape: (h, ).
  • str_cov (str.) – the name of covariance function.
  • prior_mu_train (numpy.ndarray) – the prior values computed by get_prior_mu(). Shape: (n, 1).
  • use_ard (bool., optional) – flag for automatic relevance determination.
  • fix_noise (bool., optional) – flag for fixing a noise.
  • use_cholesky (bool., optional) – flag for using a cholesky decomposition.
  • use_gradient (bool., optional) – flag for computing and returning gradients of negative log marginal likelihood.
  • debug (bool., optional) – flag for printing log messages.
Returns:

negative log marginal likelihood, or (negative log marginal likelihood, gradients of the likelihood).

Return type:

float, or tuple of (float, np.ndarray)

Raises:

AssertionError

bayeso.gp.gp_likelihood.neg_log_pseudo_l_loocv(X_train: numpy.ndarray, Y_train: numpy.ndarray, hyps: numpy.ndarray, str_cov: str, prior_mu_train: numpy.ndarray, fix_noise: bool = True, debug: bool = False) → float

It computes a negative log pseudo-likelihood using leave-one-out cross-validation.

Parameters:
  • X_train (numpy.ndarray) – inputs. Shape: (n, d) or (n, m, d).
  • Y_train (numpy.ndarray) – outputs. Shape: (n, 1).
  • hyps (numpy.ndarray) – hyperparameters for Gaussian process. Shape: (h, ).
  • str_cov (str.) – the name of covariance function.
  • prior_mu_train (numpy.ndarray) – the prior values computed by get_prior_mu(). Shape: (n, 1).
  • fix_noise (bool., optional) – flag for fixing a noise.
  • debug (bool., optional) – flag for printing log messages.
Returns:

negative log pseudo-likelihood.

Return type:

float

Raises:

AssertionError