gp_energy | R Documentation |
Returns the energy (negative log marginal likelihood) of a fitted GP model with the
current hyperparameters. The result is exact for the Gaussian likelihood and
dependent on the approx
for other cases.
gp_energy(gp, include_prior = TRUE)
gp |
The fitted GP model. |
include_prior |
Whether to add log density of the prior to the result (in which case the result is -(log marginal likelihood + log prior)) |
The energy value (negative log marginal likelihood).
Rasmussen, C. E. and Williams, C. K. I. (2006). Gaussian processes for machine learning. MIT Press.
# Generate some toy data set.seed(1242) n <- 500 x <- matrix(rnorm(n * 3), nrow = n) f <- sin(x[, 1]) + 0.5 * x[, 2]^2 + x[, 3] y <- f + 0.5 * rnorm(n) x <- data.frame(x1 = x[, 1], x2 = x[, 2], x3 = x[, 3]) # Basic usage gp <- gp_init(cf_sexp(), lik_gaussian()) gp <- gp_fit(gp, x, y) e <- gp_energy(gp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.