| do.spca | R Documentation |
Sparse PCA (do.spca) is a variant of PCA in that each loading - or, principal
component - should be sparse. Instead of using generic optimization package,
we opt for formulating a problem as semidefinite relaxation and utilizing ADMM.
do.spca(X, ndim = 2, mu = 1, rho = 1, ...)
X |
an |
ndim |
an integer-valued target dimension. |
mu |
an augmented Lagrangian parameter. |
rho |
a regularization parameter for sparsity. |
... |
extra parameters including
|
a named Rdimtools S3 object containing
an (n\times ndim) matrix whose rows are embedded observations.
a (p\times ndim) whose columns are basis for projection.
name of the algorithm.
Kisung You
zou_sparse_2006Rdimtools
\insertRefdaspremont_direct_2007Rdimtools
\insertRefma_alternating_2013Rdimtools
do.pca
## use iris data
data(iris, package="Rdimtools")
set.seed(100)
subid = sample(1:150,50)
X = as.matrix(iris[subid,1:4])
lab = as.factor(iris[subid,5])
## try different regularization parameters for sparsity
out1 <- do.spca(X,ndim=2,rho=0.01)
out2 <- do.spca(X,ndim=2,rho=1)
out3 <- do.spca(X,ndim=2,rho=100)
## visualize
opar <- par(no.readonly=TRUE)
par(mfrow=c(1,3))
plot(out1$Y, col=lab, pch=19, main="SPCA::rho=0.01")
plot(out2$Y, col=lab, pch=19, main="SPCA::rho=1")
plot(out3$Y, col=lab, pch=19, main="SPCA::rho=100")
par(opar)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.