Skip to contents

$$\bar{f}_* = K_*(K+\sigma_n^2 I)^{-1}y,\quad V_* = k_{**} - K_*(K+\sigma_n^2 I)^{-1}K_*^\top$$ Rasmussen & Williams (2006), eq. (2.23)-(2.24), p. 16; the squared-exponential covariance on p. 19. One linear solve, no iteration.

Usage

Gpreg(X, y, X_test, kernel = NULL, noise = 0)

Arguments

X

Training inputs, n x d.

y

Training targets.

X_test

Test inputs, m x d.

kernel

c(sf, l) (default c(1, 1)) or a function k(x1, x2).

noise

Observation noise standard deviation.

Value

Named list with estimate, variance, loglik, n, method.

References

Rasmussen & Williams (2006), eq. (2.23)-(2.24), (2.30).

Examples

Gpreg(matrix(c(0, 1, 2), 3, 1), c(0, 1, 0.5), matrix(c(0.5), 1, 1))$estimate
#> [1] 0.5992997