
## S3 method for class 'formula':
kpca(x, data = NULL, na.action, ...)## S3 method for class 'matrix':
kpca(x, kernel = "rbfdot", kpar = list(sigma = 0.1), features = 0, th = 1e-4, ...)
sigma
(inverse kernel width for the Radial NA
s are
found. The default action is na.omit
, which leads to rejection of cases
with missing values on any required variable. An alternative
is na.fail<
kcca
, pca
# another example using the iris
data(iris)
test <- sample(1:50,20)
kpc <- kpca(~.,data=iris[-test,-5],kernel="rbfdot",kpar=list(sigma=0.2),features=2)
#print the principal component vectors
pcv(kpc)
#plot the data projection on the components
plot(rotated(kpc),col=as.integer(iris[-test,5]),xlab="1st Principal Component",ylab="2nd Principal Component")
#embed remaining points
emb <- predict(kpc,as.matrix(iris[test,-5]))
points(emb,col=iris[test,5])
Run the code above in your browser using DataLab