bayeso.gp.gp_scipy

bayeso.gp.gp_scipy.get_optimized_kernel(X_train, Y_train, prior_mu, str_cov, str_optimizer_method='Nelder-Mead', str_modelselection_method='ml', is_fixed_noise=True, debug=False)

This function computes the kernel matrix optimized by optimization method specified, its inverse matrix, and the optimized hyperparameters.

Parameters:
  • X_train (numpy.ndarray) – inputs. Shape: (n, d) or (n, m, d).
  • Y_train (numpy.ndarray) – outputs. Shape: (n, 1).
  • prior_mu (function or NoneType) – prior mean function or None.
  • str_cov (str.) – the name of covariance function.
  • str_optimizer_method (str., optional) – the name of optimization method.
  • str_modelselection_method (str., optional) – the name of model selection method.
  • is_fixed_noise (bool., optional) – flag for fixing a noise.
  • debug (bool., optional) – flag for printing log messages.
Returns:

a tuple of kernel matrix over X_train, kernel matrix inverse, and dictionary of hyperparameters.

Return type:

tuple of (numpy.ndarray, numpy.ndarray, dict.)

Raises:

AssertionError, ValueError

bayeso.gp.gp_scipy.neg_log_ml(X_train, Y_train, hyps, str_cov, prior_mu_train, is_fixed_noise=True, is_cholesky=True, is_gradient=True, debug=False)

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).
  • is_fixed_noise (bool., optional) – flag for fixing a noise.
  • is_cholesky (bool., optional) – flag for using a cholesky decomposition.
  • is_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, float)

Raises:

AssertionError

bayeso.gp.gp_scipy.neg_log_pseudo_l_loocv(X_train, Y_train, hyps, str_cov, prior_mu_train, is_fixed_noise=True, debug=False)

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).
  • is_fixed_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