Learn R Programming

Rdimtools (version 1.1.2)

do.npe: Neighborhood Preserving Embedding

Description

do.npe performs a linear dimensionality reduction using Neighborhood Preserving Embedding (NPE) proposed by He et al (2005). It can be regarded as a linear approximation to Locally Linear Embedding (LLE). Like LLE, it is possible for the weight matrix being rank deficient. If regtype is set to TRUE with a proper value of regparam, it will perform Tikhonov regularization as designated. When regularization is needed with regtype parameter to be FALSE, it will automatically find a suitable regularization parameter and put penalty for stable computation. See also do.lle for more details.

Usage

do.npe(
  X,
  ndim = 2,
  type = c("proportion", 0.1),
  symmetric = "union",
  weight = TRUE,
  preprocess = c("null", "center", "scale", "cscale", "whiten", "decorrelate"),
  regtype = FALSE,
  regparam = 1
)

Value

a named list containing

Y

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

eigval

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

projection

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

trfinfo

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

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

FALSE for not applying automatic Tikhonov Regularization, or TRUE otherwise.

regparam

a positive real number for Regularization. Default value is 1.

Author

Kisung You

References

he_neighborhood_2005Rdimtools

Examples

Run this code
if (FALSE) {
## use iris data
data(iris)
set.seed(100)
subid = sample(1:150, 50)
X     = as.matrix(iris[subid,1:4])
label = as.factor(iris[subid,5])

## use different settings for connectivity
output1 = do.npe(X, ndim=2, type=c("proportion",0.10))
output2 = do.npe(X, ndim=2, type=c("proportion",0.25))
output3 = do.npe(X, ndim=2, type=c("proportion",0.50))

## visualize three different projections
opar <- par(no.readonly=TRUE)
par(mfrow=c(1,3))
plot(output1$Y, pch=19, col=label, main="NPE::10% connected")
plot(output2$Y, pch=19, col=label, main="NPE::25% connected")
plot(output3$Y, pch=19, col=label, main="NPE::50% connected")
par(opar)
}

Run the code above in your browser using DataLab