do.spp | R Documentation |
Sparsity Preserving Projection (SPP) is an unsupervised linear dimension reduction technique. It aims to preserve high-dimensional structure in a sparse manner to find projections that keeps such sparsely-connected pattern in the low-dimensional space. Note that we used CVXR for convenient computation, which may lead to slower execution once used for large dataset.
do.spp( X, ndim = 2, preprocess = c("center", "scale", "cscale", "decorrelate", "whiten"), reltol = 1e-04 )
X |
an (n\times p) matrix or data frame whose rows are observations |
ndim |
an integer-valued target dimension. |
preprocess |
an additional option for preprocessing the data.
Default is "center". See also |
reltol |
tolerance level for stable computation of sparse reconstruction weights. |
a named list containing
an (n\times ndim) matrix whose rows are embedded observations.
a list containing information for out-of-sample prediction.
a (p\times ndim) whose columns are basis for projection.
Kisung You
qiao_sparsity_2010Rdimtools
## Not run: ## load 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]) ## test different tolerance levels out1 <- do.spp(X,ndim=2,reltol=0.001) out2 <- do.spp(X,ndim=2,reltol=0.01) out3 <- do.spp(X,ndim=2,reltol=0.1) # visualize opar <- par(no.readonly=TRUE) par(mfrow=c(1,3)) plot(out1$Y, pch=19, col=label, main="SPP::reltol=.001") plot(out2$Y, pch=19, col=label, main="SPP::reltol=.01") plot(out3$Y, pch=19, col=label, main="SPP::reltol=.1") par(opar) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.