grammpred: Gramm Matrix for Test dataset

Description Usage Arguments Value Examples

View source: R/grammpred.R

Description

This function creates gramm matrix for test dataset based upon several types of kernel.

Usage

1
grammpred(xtrain, xtest, kernel, sigma, degree, scale)

Arguments

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

Value

Gramm matrix for test set

Examples

 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)

RMKL documentation built on May 2, 2019, 7:55 a.m.