Kernel Local Discriminant Embedding (KLDE) is a variant of Local Discriminant Embedding in that it aims to preserve inter- and intra-class neighborhood information in a nonlinear manner using kernel trick. Note that the combination of kernel matrix and its eigendecomposition often suffers from lacking numerical rank. For such case, our algorithm returns a warning message and algorithm stops working any further due to its innate limitations of constructing weight matrix.
an \((n\times p)\) matrix or data frame whose rows are observations.
a length-\(n\) vector of data class labels.
an integer-valued target dimension.
kernel bandwidth in \((0,\infty)\).
the number of neighboring points for k-nn graph construction.
an additional option for preprocessing the data.
Default is "center". See also aux.preprocess
for more details.
a vector containing name of a kernel and corresponding parameters. See also aux.kernelcov
for complete description of Kernel Trick.
a logical; TRUE
to use centered Kernel matrix, FALSE
otherwise.
a named list containing
an \((n\times ndim)\) matrix whose rows are embedded observations.
a list containing information for out-of-sample prediction.
Hwann-Tzong Chen, Huang-Wei Chang, Tyng-Luh Liu (2005). “Local Discriminant Embedding and Its Variants.” In 2005 IEEE Computer Society Conference on Computer Vision and Pattern Recognition, volume 2, 846--853.
# \donttest{
## generate data of 2 types with clear difference
set.seed(100)
diff = 25
dt1 = aux.gensamples(n=50)-diff;
dt2 = aux.gensamples(n=50)+diff;
## merge the data and create a label correspondingly
X = rbind(dt1,dt2)
label = rep(1:2, each=50)
## try different neighborhood size
out1 <- do.klde(X, label, numk=5)
out2 <- do.klde(X, label, numk=10)
out3 <- do.klde(X, label, numk=20)
## visualize
opar = par(no.readonly=TRUE)
par(mfrow=c(1,3))
plot(out1$Y, col=label, pch=19, main="k=5")
plot(out2$Y, col=label, pch=19, main="k=10")
plot(out3$Y, col=label, pch=19, main="k=20")
par(opar)
# }