Learn R Programming

Rdimtools (version 0.3.2)

do.dspp: Discriminative Sparsity Preserving Projection

Description

Discriminative Sparsity Preserving Projection (DSPP) is a supervised dimension reduction method that employs sparse representation model to adaptively build both intrinsic adjacency graph and penalty graph. It follows an integration of global within-class structure into manifold learning under exploiting discriminative nature provided from label information.

Usage

do.dspp(X, label, ndim = 2, preprocess = c("center", "scale", "cscale",
  "decorrelate", "whiten"), lambda = 1, rho = 1)

Arguments

X

an \((n\times p)\) matrix or data frame whose rows are observations.

label

a length-\(n\) vector of data class labels.

ndim

an integer-valued target dimension.

preprocess

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

lambda

regularization parameter for constructing sparsely weighted network.

rho

a parameter for balancing the local and global contribution.

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

gao_discriminative_2015Rdimtools

Examples

Run this code
# NOT RUN {
## generate data of 2 types with clear difference
diff = 15
dt1  = aux.gensamples(n=123)-diff;
dt2  = aux.gensamples(n=123)+diff;

## merge the data and create a label correspondingly
Y      = rbind(dt1,dt2)
label  = c(rep(1,123), rep(2,123))

## try different rho values
out1 <- do.dspp(Y, label, ndim=2, rho=0.01)
out2 <- do.dspp(Y, label, ndim=2, rho=0.1)
out3 <- do.dspp(Y, label, ndim=2, rho=1)

## visualize
par(mfrow=c(1,3))
plot(out1$Y[,1], out1$Y[,2], main="rho=0.01")
plot(out2$Y[,1], out2$Y[,2], main="rho=0.1")
plot(out3$Y[,1], out3$Y[,2], main="rho=1")
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab