Locality and Similarity Preserving Embedding (LSPE) is a feature selection method based on Neighborhood Preserving Embedding (`do.npe`

) and
Sparsity Preserving Projection (`do.spp`

) by first building a neighborhood graph and
then mapping the locality structure to reconstruct coefficients such that data similarity is preserved.
Use of \(\ell_{2,1}\) norm boosts to impose column-sparsity that enables feature selection procedure.

```
do.lspe(
X,
ndim = 2,
preprocess = c("null", "center", "scale", "cscale", "whiten", "decorrelate"),
alpha = 1,
beta = 1,
bandwidth = 1
)
```

## 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 "null". See also `aux.preprocess`

for more details.

- alpha
nonnegative number to control \(\ell_{2,1}\) norm of projection.

- beta
nonnegative number to control the degree of local similarity.

- bandwidth
positive number for Gaussian kernel bandwidth to define similarity.

## Value

a named list containing

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

- featidx
a length-\(ndim\) vector of indices with highest scores.

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

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

## References

Fang X, Xu Y, Li X, Fan Z, Liu H, Chen Y (2014).
“Locality and Similarity Preserving Embedding for Feature Selection.”
*Neurocomputing*, **128**, 304--315.

## Examples

```
# \donttest{
#### generate R12in72 dataset
set.seed(100)
X = aux.gensamples(n=50, dname="R12in72")
#### try different bandwidth values
out1 = do.lspe(X, bandwidth=0.1)
out2 = do.lspe(X, bandwidth=1)
out3 = do.lspe(X, bandwidth=10)
#### visualize
opar <- par(no.readonly=TRUE)
par(mfrow=c(1,3))
plot(out1$Y, main="LSPE::bandwidth=0.1")
plot(out2$Y, main="LSPE::bandwidth=1")
plot(out3$Y, main="LSPE::bandwidth=10")
par(opar)
# }
```