Description Usage Arguments Value Note Author(s) References See Also Examples
Evaluate the reconstruction error based on object with 'sKPCA' class or 'oKPCA' class.
1 | rec_predict(obj, tsdata)
|
obj |
an object with 'sKPCA' class or 'oKPCA' class. |
tsdata |
a matrix of newdata to be evaluted for reconstruction error (RE). If it is NULL, then the RE of training data is evaluated, default as NULL. |
return a numeric vector whose length is equal to the row of tsdata.
nothing
Liu Wei
nothing.
nothing
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | library(kernlab)
data(iris)
set.seed(1)
test <- sample(1:150,20)
trdata <- iris[-test,-5]
tsdata <- iris[test, -5]
n <- nrow(trdata)
kern <- rbfdot(sigma = 1e-2)
## evaluate reconstruction error for sKPCA and oKPCA
## centralized sKPCA
skc <- sKPCA(trdata, d=2, m=30, kern =kern)
rec_predict(skc, tsdata)
## centralized oKPCA
okc <- oKPCA(trdata, d=2, kern=kern)
rec_predict(okc, tsdata)
## non-centralized sKPCA
sknc <- sKPCA(trdata, d=2, m=30, kern =kern, center=F)
rec_predict(sknc, tsdata)
## non-centralized oKPCA
oknc <- oKPCA(trdata, d=2, kern=kern, center=F)
rec_predict(oknc, tsdata)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.