do.crp | R Documentation |
Collaborative Representation-based Projection (CRP) is an unsupervised linear dimension reduction method. Its embedding is based on \ell_2 graph construction, similar to that of SPP where sparsity constraint is imposed via \ell_1 optimization problem. Note that though it may be way faster, rank deficiency can pose a great deal of problems, especially when the dataset is large.
do.crp( X, ndim = 2, preprocess = c("center", "scale", "cscale", "decorrelate", "whiten"), lambda = 1 )
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 |
lambda |
regularization parameter for constructing \ell_2 graph. |
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
yang_collaborative_2015Rdimtools
do.spp
## use iris dataset data(iris) set.seed(100) subid = sample(1:150,50) X = as.matrix(iris[subid,1:4]) lab = as.factor(iris[subid,5]) ## test different regularization parameters out1 <- do.crp(X,ndim=2,lambda=0.1) out2 <- do.crp(X,ndim=2,lambda=1) out3 <- do.crp(X,ndim=2,lambda=10) # visualize opar <- par(no.readonly=TRUE) par(mfrow=c(1,3)) plot(out1$Y, col=lab, pch=19, main="CRP::lambda=0.1") plot(out2$Y, col=lab, pch=19, main="CRP::lambda=1") plot(out3$Y, col=lab, pch=19, main="CRP::lambda=10") par(opar)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.