Description Usage Arguments Value Examples
This function creates gramm matrix for traning set baed upon several types of kernel and specified hyper paremeters. This function is essentially a wrappper functions that combines gramm and grammpred. Additionally this function divides each kernel matrix by it's trace, which is a common transformation used in MKL.
1 | kernels.gen(data, train.samples, kernels, degree, scale, sigma)
|
data |
List of data matrices |
train.samples |
Vector of indices that will be used as training samples |
kernels |
Character vector of kernel types |
degree |
Degree of polynomial kernel matrix |
scale |
Leading coefficient on the polynomial kernel |
sigma |
Hyperparameter for the radial basis kernel |
K.train Gramm matricesfor training data
K.test Gramm matrices for test data
1 2 3 4 5 6 7 8 9 10 11 | library(kernlab)
data(benchmark.data)
example.data=benchmark.data[[1]]
#Dividing the samples into a train set and test set.
training.samples=sample(1:dim(example.data)[1],floor(0.7*dim(example.data)[1]),replace=FALSE)
#Specifying the type and hyperparameters for each kernel.
kernels=c('linear',rep('radial',3))
degree=rep(0,4)
scale=rep(0,4)
sigma=c(0,2^seq(-3:0))
kernels.gen(example.data[,1:2], training.samples, kernels, degree, scale, sigma)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.