Learn R Programming

Rdimtools (version 0.1.2)

do.lpp: Locality Preserving Projections

Description

do.lpp is a linear approximation to Laplacian Eigenmaps.

Usage

do.lpp(X, ndim = 2, type = c("proportion", 0.1), symmetric = "union",
  weight = TRUE, preprocess = "null", t = 1)

Arguments

X

an (n-by-p) matrix or data frame whose rows are observations

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 LPP on weighted graph, or FALSE otherwise.

preprocess

an additional option for preprocessing the data.

t

bandwidth for heat kernel in \((0,\infty)\)

Value

a named list containing

Y

an (n-by-ndim) matrix whose rows are embedded observations.

eigval

a vector of eigenvalues corresponding to basis expansion in an ascending order.

projection

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

trfinfo

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

References

he_locality_2005Rdimtools

Examples

Run this code
# NOT RUN {
## generate data
## in order to pass CRAN pretest, n is set to be small.
X <- aux.gensamples(dname="twinpeaks",n=28)

## 1. connecting 10% of data for graph construction.
output1 <- do.lpp(X,ndim=2,type=c("proportion",0.10))

## 2. constructing 25%-connected graph
output2 <- do.lpp(X,ndim=2,type=c("proportion",0.25))

## 3. constructing half-connected graph as binarized
output3 <- do.lpp(X,ndim=2,type=c("proportion",0.5),weight=FALSE)

## Visualize three different projections
if ((!is.na(output1))&&(!is.na(output2))&&(!is.na(output3))){
par(mfrow=c(1,3))
plot(output1$Y[,1],output1$Y[,2],main="5%")
plot(output2$Y[,1],output2$Y[,2],main="25%")
plot(output3$Y[,1],output3$Y[,2],main="50%")
} else {
message("* do.lpp : example : one of three trials must have failed.")
}


# }

Run the code above in your browser using DataLab