# optimal Solutions forSparse Principal Component Analysis

## Introduction

Principle component analysis (PCA) is a method for finding a linear combination of features, called principle components, that correspond to the directions that maximize the variance in the data and which are orthogonal to one another. In practice, performing PCA on a data set involves applying singular value decomposition on the data matrix.

PCA facilitates the interpretation of the data if their factors are just the combinations of a few latent variables, and not many or all of the original ones. This is particularly true in many applications in which the coordinate axes that correspond to the factors have a direct physical interpretation; for instance, in financial or biological applications, each axis might correspond to a specific asset or to a specific gene. Constraining the number of non-zero factor coefficients (loadings) in the sparse principal components to a very low number relative to the total number of coefficients whilst having these sparse vectors explain a maximum amount of variance in the data is known as sparse PCA. Sparse PCA has many applications in biology, finance and many machine learning problems. Sparse principal components, like principal components, are vectors that span a lower-dimensional space that explain most of variance in the original data. However, in order to find the sparse principal components using sparse PCA, it is necessary to make some sacrifices:

• There is a reduction in the explained variance in the original data captured by the sparse principal components as compared to PCA.
• There is a reduction in the orthogonality (independence or correlation) between the resulting variables (sparse principal components) as compared to PCA.

In this paper we are going to focus on the problem of sparse PCA which can be written as:

$\max_x \; x^{T}{A}x-\rho\textbf{Card}^{2}(x)$
$\textrm{subject} \; \textrm{to} \; \|x\|_2 \le 1$

where:

• $x\in \mathbb{R}^n$
• $A \in S_n$ is the symmetric positive semidefinite sample covariance matrix
• $\,\rho$ is the parameter which controls the sparsity
• $\textbf{Card}(x)$ expresses the cardinality ($\,l_0$ norm) of $\,x$.

Note that while solving the standard PCA problem is not complicated (since, for each factor, one simply needs to find a leading eigenvector, and this can be done in $\,O(n^2)$ time), solving sparse PCA is NP hard (since sparse PCA is a particular case of the sparse generalized eigenvalue problem).

The main part of this paper begins by formulating the sparse PCA (SPCA) problem, whose algorithm is based on the representation of PCA as a regression-type optimization problem (Zou et al., 2006) that allows the application of the LASSO (Tibshirani, 1996) (which is a penalization technique based on the $\,l_1$ norm). The main part of this paper then derives an approximate greedy algorithm for computing an approximate full set of good solutions with total complexity $\,O(n^3)$. It also formulates a convex relaxation for sparse PCA and uses it to derive tractable sufficient conditions for a vector $\,x$ to be a global optimum of the above optimization problem. In the general approach to SPCA described in this paper, for a given vector $\,x$ having support $\,I$, $\,x$ can be tested to see if it is a globally optimal solution to the above optimization problem simply by performing a few steps of binary search to solve a one-dimensional convex minimization problem.

## Notation

• For a vector $\,x \in\mathbb{R}^n$, $\|x\|_1=\sum_{i=1}^n |x_i|$ and $\textbf{Card}(x)$ is the cardinality of $\,x$ (the number of non-zero coefficients of $\,x$).
• The support $\,I$ of $\,x$ is the set $\{i: x_i \neq 0\}$ and $\,I^c$ denotes its complement.
• $\,\beta_{+} = \max\{\beta , 0\}$.
• For a symmetric $n \times n$ matrix $\,X$ with eigenvalues $\,\lambda_i$, $\operatorname{Tr}(X)_{+}=\sum_{i=1}^{n}\max\{\lambda_i,0\}$.
• The vector of all ones is written $\textbf{1}$, and the identity matrix is written $\,\textbf{I}$. The diagonal matrix with the vector $\,u$ on the diagonal is written $\textbf{diag}(u)$.
• For $A \,$, a symmetric $n \times n$ matrix, we can define $\phi(\rho) = \max_{\|x\| \leq 1} x^T A x - \rho \textbf{Card}(x)$.

## Sparse PCA

Sparse PCA problem can be written as:

$\;\phi(\rho)$
$\textrm{subject} \; \textrm{to} \; \|x\|_2=1$

It is assumed that we have a square root $\,B$ of $\,A$ with $\,A = B^TB$, where $\,B \in R^{n \times n}$.

The above problem is directly related to the following problem which involves finding a cardinality-constrained maximum eigenvalue:

$\max_x \; x^{T}{A}x$

$\textrm{subject} \; \textrm{to} \; \|x\|_2=1,\,\,\,\,\,\,\,\,\,\,\,\,\,(1)$

$\textbf{Card}(x)\leq k.$

, in the variable $\,x \in R^n$. Without loss of generality, assume that $A \geq 0$ and the features are ordered in decreasing size of variance, i.e. $A_{11} \geq \dots \geq A_{nn}$.

Using duality, we can bound the solution of (1) by:

$\inf_{\rho \in P}\phi(\rho)+\rho k$

where $\,P$ is the set of penalty values for which $\,\phi(\rho)$ has been computed. This tells us that if we prove $\,x$ is optimal for $\,\phi(\rho)$ then $\,x$ is the global optimum for $\,(1)$, with the cardinality of $\,x$ being exactly $\,k$.

Next, since $x^T A x\leq A_{11}(\sum_{i=1}^n|x_i|)^2$ and $(\sum_{i=1}^n|x_i|)^2 \leq \|x\|^2\textbf{Card}(x) \; \forall x \in R^n$ and using the above lemma while assuming $\rho \geq A_{11}$, the following will be achieved:

$\phi(\rho)=\textrm{max}_{\|x\| \le 1} \; x^{T}{A}x-\rho\textbf{Card}^{2}(x)$

$\leq (A_{11}-\rho)\textbf{Card}(x)$

$\leq 0$
.

When $\,\rho \ge A_{11}$, the optimal solution to the SPCA problem is simply $\,x = 0$.

Now we shall look at the case when $\,\rho \le A_{11}$. In this case, the inequality $\,\|x\| \le 1$ is tight. Using the fact that the sparsity pattern of a vector $\,x$ can be represented by a vector $\,u \in \{0, 1\}^n$, the fact that $\,\textbf{diag}(u)^2 = \textbf{diag}(u)$ for all variables $\,u \in \{0, 1\}^n$, and the fact that for any matrix $\,B$, $\,\lambda_{max}(B^TB) = \lambda_{max}(BB^T)$, the SPCA problem can be re-expressed as:

$\,\phi(\rho) \; = \max_{u \in \{0,1\}^n} \; \lambda_{max}(\textbf{diag}(u) \; A \; \textbf{diag}(u)) - \rho\textbf{1}^Tu$

$= \max_{u \in \{0,1\}^n} \; \lambda_{max}(\textbf{diag}(u) \; B^TB \; \textbf{diag}(u)) - \rho\textbf{1}^Tu$
$= \max_{u \in \{0,1\}^n} \; \lambda_{max}(B \; \textbf{diag}(u) \; B^T) - \rho\textbf{1}^Tu$
$= \max_{ \|x\| = 1} \; \max_{u \in \{0,1\}^n} x^T B \; \textbf{diag}(u) \; B^T x - \rho\textbf{1}^Tu$
$= \max_{ \|x\| = 1} \; \max_{u \in \{0,1\}^n} \sum_{i=1}^n u_i((b_i^T x)^2 - \rho)$.

Then, maximizing in $\,u$ and using the fact that $\,max_{v \in \{0,1\}} \beta v = \beta_+$, the SPCA problem in the case when $\,\rho \le A_{11}$ becomes:

$\phi(\rho)= \max_{\|x\|=1}\sum_{i=1}^n((b_i^Tx)^2-\rho)_{+}$
, which is a non-convex problem in $\,x \in R^n$. Note that, in this non-convex problem, we only need to select the values $\,i$ at which $\,(b_i^T x)^2 - \rho \gt 0$.

Here, the $\,b_i$'s are the elements of a matrix $\,B$ (which is mentioned above) such that $\,B^T B = A$ (i.e. $\,B$ is the square root of $\,A$).

For more detail refer to <ref name= "afl" > Alexandre d'Aspremont, Francis Bach, and Laurent El Ghaoui. 2008. Optimal Solutions for Sparse Principal Component Analysis. J. Mach. Learn. Res. 9 (June 2008), 1269-1294. </ref>.

## Greedy Solution

Before presenting their approximate greedy search algorithm for solving the SPCA problem, the authors first presented the full greedy search algorithm that follows directly from Moghaddam et al. (2006a). This algorithm starts from an initial solution (having cardinality one) at $\,\rho = A_{11}$, and then it updates an increasing sequence of index sets $\,I_k \subseteq [1, n]$ by scanning all the remaining variables to find the index that gives the maximum contribution in terms of variance.

The following pseudo-code (taken from the authors' paper listed in Reference) summarizes this full greedy search algorithm:

At every step, $\,I_k$ represents the set of non-zero elements, or the sparsity pattern, of the current point. Given $\,I_k$, the solution to the SPCA problem can be defined as $\,x_k = \underset{\{x_{I_k^c} = 0, \|x\| = 1\}}{\operatorname{argmax}} x^T A x - \rho k$, i.e. $\,x_k$ is formed simply by padding zeros to the leading eigenvector of the sub-matrix $\,A_{I_k,I_k}$.

As estimating $\,n-k$ eigenvalues at each iteration is costly, we get help from the fact that $\,uu^T$ is a sub-gradient of $\,\lambda_{max}$ at $\,X$ if $\,u$ is a leading eigenvector of $\,X$ to get $\lambda_{max}(\sum_{j\in I_k\cup \{i\}}a_ja_j^T)\geq \lambda_{max}(\sum_{j\in I_k}a_ja_j^T)+(x_k^Ta_i)^2$. With this, the authors had a lower bound on the objective which does not require finding $\,n - k$ eigenvalues at each iteration.

The authors then derived the following algorithm for solving the SPCA problem:

### Approximate Greedy Search Algorithm

Input: $\Sigma \in \textbf{R}^{n\times n}$

Algorithm:

1.Preprocessing: sort variables decreasingly diagonal elements and permute elements of $\Sigma$ accordingly. Compute Cholesky decomposition $\,\Sigma =A^TA$.

2.Initialization:$I_1=\{\}, x_1=a_1/\|a_1\|$

3.Compute $i_k= {\arg\max}_{i\notin I_k}(x_k^Ta_i)^2$

4.Set $I_{k+1}=I_k\cup\{i_k\}$ and compute $\,x_{k+1}$ as the leading eigenvector of $\sum_{j\in I_{k+1}}a_j a_j^T$

5.Set $\,k=k+1$ if $\,k\lt n$ go back to step 3.

Output: sparsity patterns $\,I_k$

As in the full greedy search algorithm, at every step, $\,I_k$ represents the set of non-zero elements, or the sparsity pattern, of the current point and, given $\,I_k$, the solution to the SPCA problem can be defined as $\,x_k = \underset{\{x_{I_k^c} = 0, \|x\| = 1\}}{\operatorname{argmax}} x^T A x - \rho k$, i.e. we form $\,x_k$ simply by padding zeros to the leading eigenvector of the sub-matrix $\,A_{I_k,I_k}$.

### Computational Complexity

The full greedy search algorithm for solving the SPCA problem has a complexity of $\,O(n^4)$ because, at each step $\,k$, it computes $\,n-k$ maximum eigenvalues of matrices having size $\,k$. On the other hand, the authors' approximate greedy search algorithm for solving the SPCA problem has a complexity of $\,O(n^3)$. This is because the first Cholesky decomposition has a complexity of $\,O(n^3)$ and, in the $\,k$th iteration, there is a complexity of $\,O(k^2)$ for the maximum eigenvalue problem and a complexity of $\,O(n^2)$ for finding all products $\,x^T b_j$.

## Convex Relaxation

As it is mentioned sparse PCA problem can be written as:

$\phi(\rho)= \max_{\|x\|=1}\sum_{i=1}^n((a_i^Tx)^2)-\rho)_{+}$

reformulate the problem by changing $X=xx^T$,thus we rewrite the equivalant:

$\phi(\rho)= \max\sum_{i=1}^n((a_i^TXa_i)^2)-\rho)_{+}$

$s.t. \textbf{Tr}(X)=1,\textbf{Rank}(X)=1, X\geq 0$

As the goal is to maximize a convex function over the convex set,$\Delta_n=\{X\in S_n : \textbf{Tr}(X)=1, X\geq 0\}$ the solution should be an exterme point of $\Delta_n$. unfortunately the adressed problem which we are going to solve is convex in $X$ and not concave. So the problem is still harf to solve. How ever It is shown on <ref name="afl"/> that on rank one elements of $\Delta_n$, it is equal to a concave function $X$ and we use this to produce a semidefinite relaxation of the problem. The proposition is as below and the proof is provided in the paper.

Proposition 1 Let $A\in{R}^{n\times n}, \rho \geq0$ and denotes by $a_1,...,a_n\in R^n$ the columns of $A$ an upper bound on:

$\phi(\rho)= \max\sum_{i=1}^n((a_i^TXa_i)^2)-\rho)_{+}$

$s.t. \textbf{Tr}(X)=1,\textbf{Rank}(X)=1, X\geq 0$</center>

can be computed by solving

$\psi(\rho)= \max\sum_{i=1}^n(\textbf{Tr}(X^{1/2}B_iX^{1/2})_{+}$

$s.t. \textbf{Tr}(X)=1, X\geq 0$

in the variable $X\in S_n$where $B_i=a_ia_i^T-\rho I$ or also:

$\psi(\rho)= \max\sum_{i=1}^n(\textbf{Tr}(P_iB_i)_{+}$

$s.t. \textbf{Tr}(X)=1, X\geq 0, X\geq P_i \geq 0$

which is semidefinite programming in the variables $X\in S_n, P_i\in S_n$

## Application

In this section we mention the application of sparse PCA to subset selection. One of the other application is compressed sensing which you can see more detail about it on the main paper:

### Subset selection

we consider $p$ datapoints in $R^n$ in a data matrix $X \in R^{p\times n}$. We are given real numbers $y \in R^p$ to predict from $X$ using linear regression, estimated by least squares. In subset selection problem we are looking for sparse coefficient $w$ i.e a vector $w$ with many zeros. we thus consider the problem:

$s(k)=\min_{w\in R^n, \textbf{Card}(w)\leq k}\|y-Xw\|^2$

using sparsity patter $u\in \{0,1\}$ and optimizing with respect to $w$ and rewriting the formula using generalized eigenvalue we thus have:

$s(k)=\|y\|^2- \max_{u\in \{0,1\}, \textbf{1}^Tu\leq k}\max_{w\in R^n}\frac{w^T\textbf{diag}(u)X^Tyy^TX\textbf{diag}(u)w}{w^TX(u)^TX(u)w}$

the simple bound on the optimal value of the subset selection problem with the following form:

$w^T(X(v)^Tyy^TX(v)-s_0X(v)^TX(v))w\leq B$

where $B\geq0$, thus we have :

$\|y\|^2-s_0\geq(k)\geq\|y\|^2-s_0-B(\min_{v\in\{0,1\}^n,1^Tv=k}\lambda_{min}(X(v)^TX(v)))^{-1}$

$\geq\|y\|^2-s_0-B(\lambda_{min}(X^TX))^{-1}$

This bound gives a sufficient condition for optimality in subset selection, for any problem instances and any given subset.

## Conclusion

Here present a new convex relaxation of sparse principal component analysis. The sufficient conditions are derived for optimality <ref name="afl"/>. Those conditions go together with efficient greedy algorithms that provide candidate solutions, many of which turn out to be optimal in practice. Finally the resulting upper bound has direct application to problems such as sparse recovery and subset selection.

<references />