gausspr is an implementation of Gaussian processes.
Gaussian processes can be used for classification and regression.## S3 method for class 'formula':
gausspr(x, data=NULL, ..., subset, na.action = na.omit)## S3 method for class 'vector':
gausspr(x,...)
## S3 method for class 'matrix':
gausspr(x, y, type="classification", kernel="rbfdot", kpar=list(sigma = 0.1),
var=1, tol=0.001, cross=0, fit=TRUE, ... , subset, na.action = na.omit)
x. Can be either
a factor (for classification tasks) or a numeric vector (for
regression).sigma(inverse kernel width for the Radial NAs are
found. The default action is na.omit, which leads to rejection of cases
with missing values on any required variable. An alternative
is na.fail<rvm, ksvm# train model
data(iris)
test <- gausspr(Species~.,data=iris,var=2)
test
alpha(test)
# predict on the training set
predict(test,iris[,-5])
# create regression data
x <- seq(-20,20,0.1)
y <- sin(x)/x + rnorm(401,sd=0.03)
# regression with gaussian processes
foo <- gausspr(x, y)
foo
# predict and plot
ytest <- predict(foo, x)
plot(x, y, type ="l")
lines(x, ytest, col="red")Run the code above in your browser using DataLab