Locality Pursuit Embedding (LPE) is an unsupervised linear dimension reduction method.
It aims at preserving local structure by solving a variational problem that models
the local geometrical structure by the Euclidean distances.

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

## Arguments

- X
an \((n\times p)\) matrix or data frame whose rows are observations
and columns represent independent variables.

- ndim
an integer-valued target dimension.

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

for more details.

- numk
size of \(k\)-nn neighborhood in original dimensional space.

## 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

Min W, Lu K, He X (2004).
“Locality Pursuit Embedding.”
*Pattern Recognition*, **37**(4), 781--788.

## Examples

```
# \donttest{
## generate swiss roll with auxiliary dimensions
set.seed(100)
n = 100
theta = runif(n)
h = runif(n)
t = (1+2*theta)*(3*pi/2)
X = array(0,c(n,10))
X[,1] = t*cos(t)
X[,2] = 21*h
X[,3] = t*sin(t)
X[,4:10] = matrix(runif(7*n), nrow=n)
## try with different neighborhood sizes
out1 = do.lpe(X, numk=5)
out2 = do.lpe(X, numk=10)
out3 = do.lpe(X, numk=25)
## visualize
opar <- par(no.readonly=TRUE)
par(mfrow=c(1,3))
plot(out1$Y, main="LPE::numk=5")
plot(out2$Y, main="LPE::numk=10")
plot(out3$Y, main="LPE::numk=25")
par(opar)
# }
```