| gp_fit | R Documentation |
Function gp_fit fits a GP model with the current hyperparameters.
Notice that this function does not optimize the hyperparameters in any way,
but only finds the analytical posterior approximation (depending on chosen
approx) for the latent values with the current hyperparameters.
For optimizing the hyperparameter
values, see gp_optim.
gp_fit(gp, x, y, trials = NULL, offset = NULL, jitter = NULL, ...)
gp |
The gp model object to be fitted. |
x |
n-by-d matrix of input values (n is the number of observations and d the input dimension). Can also be a vector of length n if the model has only a single input. |
y |
Vector of n output (target) values. |
trials |
Vector of length n giving the number of trials for each observation in binomial (and beta binomial) model. |
offset |
Vector of constant values added to the latent values f_i (i = 1,...,n). For Poisson models, this is the logarithm of the exposure time in each observation. |
jitter |
Magnitude of diagonal jitter for covariance matrices for numerical stability. Default is 1e-6. |
... |
Currently ignored |
An updated GP model object.
Rasmussen, C. E. and Williams, C. K. I. (2006). Gaussian processes for machine learning. MIT Press.
# Generate some toy data set.seed(32004) n <- 150 sigma <- 0.1 x <- rnorm(n) ycont <- sin(3 * x) * exp(-abs(x)) + rnorm(n) * sigma y <- rep(0, n) y[ycont > 0] <- 1 trials <- rep(1, n) # Fit the model using Laplace approximation (with the specified hyperparameters) cf <- cf_sexp(lscale = 0.3, magn = 3) gp <- gp_init(cf, lik_binomial()) gp <- gp_fit(gp, x, y, trials = trials)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.