Locally-Linear Embedding (LLE) was introduced approximately at the same time as Isomap.
Its idea was motivated to describe entire data manifold by making a chain of local patches
in that low-dimensional embedding should resemble the connectivity pattern of patches.
`do.lle`

also provides an automatic choice of regularization parameter based on an
optimality criterion suggested by authors.

```
do.lle(
X,
ndim = 2,
type = c("proportion", 0.1),
symmetric = "union",
weight = TRUE,
preprocess = c("null", "center", "scale", "cscale", "decorrelate", "whiten"),
regtype = FALSE,
regparam = 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.

- type
a vector of neighborhood graph construction. Following types are supported;
`c("knn",k)`

, `c("enn",radius)`

, and `c("proportion",ratio)`

.
Default is `c("proportion",0.1)`

, connecting about 1/10 of nearest data points
among all data points. See also `aux.graphnbd`

for more details.

- symmetric
one of `"intersect"`

, `"union"`

or `"asymmetric"`

is supported. Default is `"union"`

.
See also `aux.graphnbd`

for more details.

- weight
`TRUE`

to perform LLE on weighted graph, or `FALSE`

otherwise.

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

for more details.

- regtype
`TRUE`

for automatic regularization parameter selection, `FALSE`

otherwise as default.

- regparam
regularization parameter.

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

- eigvals
a vector of eigenvalues from computation of embedding matrix.

## References

Roweis ST (2000).
“Nonlinear Dimensionality Reduction by Locally Linear Embedding.”
*Science*, **290**(5500), 2323--2326.

## Examples

```
# \donttest{
## generate swiss-roll data
set.seed(100)
X = aux.gensamples(n=100)
## 1. connecting 10% of data for graph construction.
output1 <- do.lle(X,ndim=2,type=c("proportion",0.10))
## 2. constructing 20%-connected graph
output2 <- do.lle(X,ndim=2,type=c("proportion",0.20))
## 3. constructing 50%-connected with bigger regularization parameter
output3 <- do.lle(X,ndim=2,type=c("proportion",0.5),regparam=10)
## Visualize three different projections
opar <- par(no.readonly=TRUE)
par(mfrow=c(1,3))
plot(output1$Y, main="5%")
plot(output2$Y, main="10%")
plot(output3$Y, main="50%+Binary")
par(opar)
# }
```