Description Usage Arguments Details Value Author(s) References Examples
Computes the qkernel Locally Linear Embedding
1 2 3 4 5 6 7 | ## S4 method for signature 'matrix'
qkLLE(x, kernel = "rbfbase", qpar = list(sigma = 0.1, q = 0.9),
dims = 2, k, na.action = na.omit, ...)
## S4 method for signature 'cndkernmatrix'
qkLLE(x, dims = 2, k, na.action = na.omit, ...)
## S4 method for signature 'qkernmatrix'
qkLLE(x, dims = 2, k, na.action = na.omit,...)
|
x |
N x D matrix (N samples, D features) or a kernel matrix of |
kernel |
the kernel function used in training and predicting. This parameter can be set to any function, of class kernel, which computes a kernel function value between two vector arguments. qkerntool provides the most popular kernel functions which can be used by setting the kernel parameter to the following strings:
The kernel parameter can also be set to a user defined function of class kernel by passing the function name as an argument. |
qpar |
the list of hyper-parameters (kernel parameters). This is a list which contains the parameters to be used with the kernel function. Valid parameters for existing kernels are :
Hyper-parameters for user defined kernels can be passed through the qpar parameter as well. |
dims |
dimension of the target space |
k |
the number of nearest neighbours. |
na.action |
A function to specify the action to be taken if |
... |
additional parameters |
The qkernel Locally Linear Embedding (qkLLE) preserves local properties of the data by
representing each sample in the data by a linear combination of
its k nearest neighbours with each neighbour weighted
independently. qkLLE finally chooses the low-dimensional
representation that best preserves the weights in the target
space. It is an extension of Locally Linear Embedding (LLE) with qkernel method.
It returns an S4 object containing the principal component vectors along with the corresponding eigenvalues.
prj |
a matrix with the reduced input data |
dims |
dimension of the target space |
eVal |
The corresponding eigenvalues |
eVec |
The corresponding eigenvectors |
cndkernf |
the kernel function used |
all the slots of the object can be accessed by accessor functions.
Yusen Zhang
yusenzhang@126.com
Roweis, Sam T. and Saul, Lawrence K., "Nonlinear Dimensionality Reduction by Locally Linear Embedding",2000;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## S4 method for signature 'matrix'
data(iris)
testset <- sample(1:150,20)
train <- as.matrix(iris[-testset,-5])
labeltrain<- as.integer(iris[-testset,5])
test <- as.matrix(iris[testset,-5])
plot(train ,col=labeltrain, xlab="1st Principal Component",ylab="2nd Principal Component")
# ratibase(c=1,q=0.8)
d_low <- qkLLE(train, kernel = "ratibase", qpar = list(c=1,q=0.8), dims=2, k=5)
#plot the data projection on the components
plot(prj(d_low),col=labeltrain, xlab="1st Principal Component",ylab="2nd Principal Component")
## S4 method for signature 'qkernmatrix'
# ratibase(c=0.1,q=0.8)
qkfunc <- ratibase(c=0.1,q=0.8)
ktrain1 <- qkernmatrix(qkfunc,train)
d_low <- qkLLE(ktrain1, dims = 2, k=5)
#plot the data projection on the components
plot(prj(d_low),col=labeltrain, xlab="1st Principal Component",ylab="2nd Principal Component")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.