gp {gptools2}R Documentation

Gaussian Process

Description

Gaussian Process

Usage

gp(X, y, kernel = squared_exponential(), sigma = 0, options = list())

Arguments

X

A numeric matrix; the data.

y

A numeric vector; the data.

kernel

A kernel object, which is a named list of a list of named parameters and an uninitialised kernel function.

sigma

A positive number; the noise of the data.

options

Optional argument to pass to optim.

Examples

## Not run: 
library(gptools2)
x <-  as.matrix(seq(-10, 10, 1.5))
f <- sin
y <- f(x)
model <- gp(x, y, sigma = 0)
pred_y <- predict_gp(model, x)
cbind(y, pred_y$mean, err = y - pred_y$mean)

test_x <- as.matrix(seq(-10, 10, 0.1))
test_y <- f(test_x)
pred_y <- predict_gp(model, test_x)
cbind(test_y, pred_y$mean, err = test_y - pred_y$mean)

plot(x, y, pch = 19, xlim = c(-10, 10))
lines(test_x, test_y, type = 'l', lty = 2)
lines(test_x, pred_y$mean, col = 'blue')

## End(Not run)

[Package gptools2 version 0.1.10 Index]