gausspr is an implementation of Gaussian processes
for classification and regression.## S3 method for class 'formula':
gausspr(x, data=NULL, ..., subset, na.action = na.omit, scaled = TRUE)## S3 method for class 'vector':
gausspr(x,...)
## S3 method for class 'matrix':
gausspr(x, y, scaled = TRUE, type= NULL, kernel="rbfdot", kpar="automatic",
var=1, tol=0.0005, cross=0, fit=TRUE, ... , subset, na.action = na.omit)
x. Can be either
a factor (for classification tasks) or a numeric vector (for
regression).y is a factor or not, the default
setting for type is classification or regression,
respectively, but can be ovescaled is of length 1, the value is recycled as
many times as needed and all non-binary variables are scaled.
Per default, data are scaled internally (both x sigmainverse kernel width for the Radial BasisNAs 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, whitype parameter to "probabilities".predict.gausspr, rvm, ksvm, gausspr-class, lssvm# train model
data(iris)
test <- gausspr(Species~.,data=iris,var=2)
test
alpha(test)
# predict on the training set
predict(test,iris[,-5])
# class probabilities
predict(test, iris[,-5], type="probabilities")
# 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