Description Usage Arguments Value Examples
This function creates gramm matrix for test dataset based upon several types of kernel.
1 |
xtrain |
Matrix of predictors for the training set |
xtest |
Matrix of predictors for the test set |
kernel |
Type of kernel used to compute a gramm matrix |
sigma |
Hyperparameters for radial kernels |
degree, scale |
Hyperparameter for polynomial kernel |
Gramm matrix for test set
1 2 3 4 5 6 7 8 9 10 11 | library(kernlab)
data(benchmark.data)
example.data=benchmark.data[[1]]
#Create split between training samples and test samples
training.samples=sample(1:dim(example.data)[1],floor(0.7*dim(example.data)[1]),replace=FALSE)
xtrain=example.data[training.samples,1:2]
xtest=example.data[-training.samples,1:2]
#Generate linear kernel
grammpred(xtrain,xtest,'linear',0,0,0)
#Generate radial kernels with different values for the hyperparameter.
grammpred(xtrain,xtest,'radial',2^seq(-3:0),0,0)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.