Package 'amanpg'

Title: Alternating Manifold Proximal Gradient Method for Sparse PCA
Description: Alternating Manifold Proximal Gradient Method for Sparse PCA uses the Alternating Manifold Proximal Gradient (AManPG) method to find sparse principal components from a data or covariance matrix. Provides a novel algorithm for solving the sparse principal component analysis problem which provides advantages over existing methods in terms of efficiency and convergence guarantees. Chen, S., Ma, S., Xue, L., & Zou, H. (2020) <doi:10.1287/ijoo.2019.0032>. Zou, H., Hastie, T., & Tibshirani, R. (2006) <doi:10.1198/106186006X113430>. Zou, H., & Xue, L. (2018) <doi:10.1109/JPROC.2018.2846588>.
Authors: Shixiang Chen [aut], Justin Huang [aut], Benjamin Jochem [aut], Shiqian Ma [aut], Haichuan Xu [aut], Lingzhou Xue [aut], Zhong Zheng [cre, aut], Hui Zou [aut]
Maintainer: Zhong Zheng <[email protected]>
License: MIT + file LICENSE
Version: 0.3.4
Built: 2024-11-09 06:25:11 UTC
Source: CRAN

Help Index


Matrix Normalization

Description

Center the input matrix to mean 0 and scale to Euclidean length 1

Usage

normalize(x, center=TRUE, scale=TRUE)

Arguments

x

matrix to be normalized

center

centers the input matrix to mean 0 if TRUE, default if TRUE

scale

scales the input matrix to Euclidean length 1 if TRUE, default is TRUE

Value

x

normalized matrix

Author(s)

Shixiang Chen, Justin Huang, Benjamin Jochem, Shiqian Ma, Lingzhou Xue and Hui Zou


Proximal L1 Mapping

Description

Calculates the proximal L1 mapping for the given input matrix

Usage

prox.l1(z, lambda, r)

Arguments

z

input matrix

lambda

parameters for calculating proximal L1 mapping

r

number of columns used in matrix

Value

x_prox

proximal L1 Mapping

Author(s)

Shixiang Chen, Justin Huang, Benjamin Jochem, Shiqian Ma, Lingzhou Xue and Hui Zou

References

Chen, S., Ma, S., Xue, L., and Zou, H. (2020) "An Alternating Manifold Proximal Gradient Method for Sparse Principal Component Analysis and Sparse Canonical Correlation Analysis" *INFORMS Journal on Optimization* 2:3, 192-208


Alternating Manifold Proximal Gradient algorithm for Sparse PCA

Description

Performs sparse principal component analysis on the input matrix using an alternating manifold proximal gradient (AManPG) method

Usage

spca.amanpg(z, lambda1, lambda2, f_palm = 1e5, x0 = NULL, y0 = NULL, k = 0, type = 0,
       gamma = 0.5, maxiter = 1e4, tol = 1e-5, normalize = TRUE, verbose = FALSE)

Arguments

z

Either the data matrix or sample covariance matrix

lambda1

List of parameters of length n for L1-norm penalty

lambda2

L2-norm penalty term

f_palm

Upper bound for the gradient value to reach convergence, default value is 1e5

x0

Initial x-values for the gradient method, default value is the first n right singular vectors

y0

Initial y-values for the gradient method, default value is the first n right singular vectors

k

Number of principal components desired, default is 0 (returns min(n-1, p) principal components)

type

If 0, b is expected to be a data matrix, and otherwise b is expected to be a covariance matrix; default is 0

gamma

Parameter to control how quickly the step size changes in each iteration, default is 0.5

maxiter

Maximum number of iterations allowed in the gradient method, default is 1e4

tol

Tolerance value required to indicate convergence (calculated as difference between iteration f-values), default is 1e-5

normalize

Center and normalize rows to Euclidean length 1 if True, default is True

verbose

Function prints progress between iterations if True, default is False

Value

iter

total number of iterations executed in the algorithm

f_amanpg

final gradient value

sparsity

Number of sparse loadings (loadings == 0) divided by number of all loadings

time

execution time in seconds

x

corresponding matrix in subproblem to the loadings

loadings

loadings of the sparse principal components

Author(s)

Shixiang Chen, Justin Huang, Benjamin Jochem, Shiqian Ma, Lingzhou Xue and Hui Zou

References

Chen, S., Ma, S., Xue, L., and Zou, H. (2020) "An Alternating Manifold Proximal Gradient Method for Sparse Principal Component Analysis and Sparse Canonical Correlation Analysis" *INFORMS Journal on Optimization* 2:3, 192-208

Examples

#see SPCA.R for a more in-depth example
      d <- 500  # dimension
      m <- 1000 # sample size
      a <- normalize(matrix(rnorm(m * d), m, d))
      lambda1 <- 0.1 * matrix(data=1, nrow=4, ncol=1)
      x0 <- svd(a, nv=4)$v
      sprout <- spca.amanpg(a, lambda1, lambda2=Inf, f_palm=1e5, x0=x0, y0=x0, k=4, type=0, 
                            gamma=0.5, maxiter=1e4, tol=1e-5, normalize = FALSE, verbose=FALSE)
      print(paste(sprout$iter, "iterations,", sprout$sparsity, "sparsity,", sprout$time))

      #extract loadings
      #print(sprout$loadings)