gaussKern {BKPC} | R Documentation |
Calculates Gaussian kernel: k(x,x') = \exp(-θ \|x - x'\|^2)
gaussKern(x, newdata = x, theta = NULL)
x |
a data matrix. |
newdata |
optional second data matrix. |
theta |
the inverse kernel bandwidth parameter. If |
Also known as the radial basis kernel function, see rbfdot
(in package kernlab)
Returns a list containing the following components:
K |
a Gaussian kernel matrix of class |
theta |
the inverse kernel bandwidth parameter. |
K. Domijan
kPCA
bkpc
kernelMatrix
(in package kernlab)
data(iris) testset <- sample(1:150,20) train <- as.matrix(iris[-testset ,-5]) test <- as.matrix(iris[testset ,-5]) # make training set kernel gk <- gaussKern(train) Ktrain <- gk$K image(Ktrain) # make testing set kernel gk2 <- gaussKern(train, test, gk$theta) Kest <- gk2$K