Extended LPP and Supervised LPP are two variants of the celebrated Locality Preserving Projection (LPP) algorithm for dimension
reduction. Their combination, Extended Supervised LPP, is a combination of two algorithmic novelties in one that
it reflects discriminant information with realistic distance measure via Z-score function.

```
do.eslpp(
X,
label,
ndim = 2,
numk = max(ceiling(nrow(X)/10), 2),
preprocess = c("center", "scale", "cscale", "decorrelate", "whiten")
)
```

## Arguments

- X
an \((n\times p)\) matrix or data frame whose rows are observations.

- label
a length-\(n\) vector of data class labels.

- ndim
an integer-valued target dimension.

- numk
the number of neighboring points for k-nn graph construction.

- preprocess
an additional option for preprocessing the data.
Default is "center". See also `aux.preprocess`

for more details.

## Value

a named list containing

- Y
an \((n\times ndim)\) matrix whose rows are embedded observations.

- trfinfo
a list containing information for out-of-sample prediction.

- projection
a \((p\times ndim)\) whose columns are basis for projection.

## References

Zheng Z, Yang F, Tan W, Jia J, Yang J (2007).
“Gabor Feature-Based Face Recognition Using Supervised Locality Preserving Projection.”
*Signal Processing*, **87**(10), 2473--2483.

Shikkenawis G, Mitra SK (2012).
“Improving the Locality Preserving Projection for Dimensionality Reduction.”
In *2012 Third International Conference on Emerging Applications of Information Technology*, 161--164.

## Examples

```
## generate data of 2 types with clear difference
set.seed(100)
diff = 50
dt1 = aux.gensamples(n=50)-diff;
dt2 = aux.gensamples(n=50)+diff;
## merge the data and create a label correspondingly
Y = rbind(dt1,dt2)
label = rep(1:2, each=50)
## compare LPP, SLPP and ESLPP
outLPP <- do.lpp(Y)
outSLPP <- do.slpp(Y, label)
outESLPP <- do.eslpp(Y, label)
## visualize
opar <- par(no.readonly=TRUE)
par(mfrow=c(1,3))
plot(outLPP$Y, col=label, pch=19, main="LPP")
plot(outSLPP$Y, col=label, pch=19, main="SLPP")
plot(outESLPP$Y, col=label, pch=19, main="ESLPP")
par(opar)
```