Skip to contents

The latent-function posterior and the input-dependent noise process are predicted separately. Observation variance is the sum of latent posterior variance and the plug-in estimated noise variance. Uncertainty about the log-noise process is returned separately and is not folded into the observation variance.

Usage

predict_heteroscedastic_gp(
  model,
  x,
  interval_level = 0.95,
  include_covariance = FALSE,
  variance_tolerance = sqrt(.Machine$double.eps)
)

Arguments

model

A fitted heteroscedastic GP model.

x

Numeric vector or matrix of prediction inputs.

interval_level

Probability level for returned intervals.

include_covariance

If TRUE, include the full latent and observation covariance matrices.

variance_tolerance

Relative tolerance for latent posterior variances.

Value

An object of class gaussianprocesses_heteroscedastic_prediction. It has the fields that every prediction in the package shares (see predict_gp()), with the plug-in noise estimate as observation_noise_variance, and in addition noise_log_variance, its posterior variance noise_log_variance_uncertainty, and noise_variance_interval from the log-noise GP.

Stability

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

Examples

simulation <- gp_simulation_scenario("heteroscedastic_1d", n = 60)
model <- fit_heteroscedastic_gp(
  simulation$x,
  simulation$observed,
  kernel = matern52_kernel(length_scale = 0.2),
  noise_kernel = rbf_kernel(length_scale = 0.4),
  max_iterations = 30
)
#> Warning: The heteroscedastic noise estimate did not converge in 30 iterations: the last largest change in log noise variance was 0.0326, above convergence_tolerance = 0.001. Increase max_iterations.

prediction <- predict_heteroscedastic_gp(model, c(0.1, 0.9))

# Observation variance = latent variance + estimated noise variance.
cbind(
  latent = prediction$latent_variance,
  noise = prediction$observation_noise_variance,
  observation = prediction$observation_variance
)
#>           latent      noise observation
#> [1,] 0.004079055 0.02035853  0.02443758
#> [2,] 0.019234273 0.13493782  0.15417210