Skip to contents

Fixes one estimated hyperparameter at each of a grid of values and maximizes the log marginal likelihood over the others.

Usage

gp_profile_likelihood(
  model,
  parameter,
  values = NULL,
  n_values = 11L,
  step = 1e-04
)

Arguments

model

A fitted gaussianprocesses_model, normally from optimize_gp().

parameter

Path of the parameter, as in kernel_parameters(model$kernel, flatten = TRUE), or "noise_variance".

values

Values of the parameter on its natural scale. If NULL, a grid of n_values points spanning three standard errors either side of the estimate on the coordinate scale, or one unit when the standard error is not available.

n_values

Number of grid points when values is NULL.

step

Step of the central differences of the gradient, on the optimizer's coordinate scale.

Value

A data frame of class gaussianprocesses_profile_likelihood with one row per value: value, log_marginal_likelihood, deviance, and converged.

Details

At each value the other estimated hyperparameters start from their estimates and are re-optimized with L-BFGS-B and the analytical gradient, within the bounds that optimize_gp() used. deviance is twice the drop in log marginal likelihood from the estimate, and converged whether the other parameters reached a stationary point: the optimizer converged, or the gradient there is below \(10^{-4}\). Under the usual asymptotics values with deviance below qchisq(0.95, 1) form an approximate 95% interval. A flat profile shows a poorly identified parameter directly.

Stability

Experimental: this interface may change in a minor release, and every change is listed in NEWS. See gaussianprocesses-package for the policy.

Examples

set.seed(1)
x <- seq(0, 10, length.out = 40)
model <- optimize_gp(x, sin(x) + rnorm(40, sd = 0.2), rbf_kernel(),
  noise_variance = 0.1, n_starts = 1)

gp_profile_likelihood(model, "length_scale", n_values = 5)
#>      value log_marginal_likelihood      deviance converged
#> 1 0.827464               -5.828038  5.543678e+00      TRUE
#> 2 1.076742               -3.950125  1.787853e+00      TRUE
#> 3 1.401115               -3.056198 -7.105427e-14      TRUE
#> 4 1.823208               -4.157088  2.201779e+00      TRUE
#> 5 2.372459               -6.040327  5.968257e+00      TRUE