# L1-norm principal component analysis

L1-norm principal component analysis (L1-PCA) is a general method for multivariate data analysis. L1-PCA is often preferred over standard L2-norm principal component analysis (PCA) when the analyzed data may contain outliers (faulty values or corruptions), as it is believed to be robust.
Both L1-PCA and standard PCA seek a collection of orthogonal directions (principal components) that define a subspace wherein data representation is maximized according to the selected criterion. Standard PCA quantifies data representation as the aggregate of the L2-norm of the data point projections into the subspace, or equivalently the aggregate Euclidean distance of the original points from their subspace-projected representations. L1-PCA uses instead the aggregate of the L1-norm of the data point projections into the subspace. In PCA and L1-PCA, the number of principal components (PCs) is lower than the rank of the analyzed matrix, which coincides with the dimensionality of the space defined by the original data points. Therefore, PCA or L1-PCA are commonly employed for dimensionality reduction for the purpose of data denoising or compression. Among the advantages of standard PCA that contributed to its high popularity are low-cost computational implementation by means of singular-value decomposition (SVD) and statistical optimality when the data set is generated by a true multivariate normal data source.
However, in modern big data sets, data often include corrupted, faulty points, commonly referred to as outliers. Standard PCA is known to be sensitive to outliers, even when they appear as a small fraction of the processed data. The reason is that the L2-norm formulation of L2-PCA places squared emphasis on the magnitude of each coordinate of each data point, ultimately overemphasizing peripheral points, such as outliers. On the other hand, following an L1-norm formulation, L1-PCA places linear emphasis on the coordinates of each data point, effectively restraining outliers.

## Formulation

Consider any matrix $\mathbf {X} =[\mathbf {x} _{1},\mathbf {x} _{2},\ldots ,\mathbf {x} _{N}]\in \mathbb {R} ^{D\times N}$ consisting of $N$ $D$-dimensional data points. Define $r=rank(\mathbf {X} )$. For integer $K$ such that $1\leq K<r$, L1-PCA is formulated as:
| ${\begin{aligned}&{\underset {\mathbf {Q} =[\mathbf {q} _{1},\mathbf {q} _{2},\ldots ,\mathbf {q} _{K}]\in \mathbb {R} ^{D\times K}}{\max }}~~\|\mathbf {X} ^{\top }\mathbf {Q} \|_{1}\\&{\text{subject to}}~~\mathbf {Q} ^{\top }\mathbf {Q} =\mathbf {I} _{K}.\end{aligned}}$ | (1) |
For $K=1$, (1) simplifies to finding the L1-norm principal component (L1-PC) of $\mathbf {X}$ by
| ${\begin{aligned}&{\underset {\mathbf {q} \in \mathbb {R} ^{D\times 1}}{\max }}~~\|\mathbf {X} ^{\top }\mathbf {q} \|_{1}\\&{\text{subject to}}~~\|\mathbf {q} \|_{2}=1.\end{aligned}}$ | (2) |
In (1)-(2), L1-norm $\|\cdot \|_{1}$ returns the sum of the absolute entries of its argument and L2-norm $\|\cdot \|_{2}$ returns the sum of the squared entries of its argument. If one substitutes $\|\cdot \|_{1}$ in (2) by the Frobenius/L2-norm $\|\cdot \|_{F}$, then the problem becomes standard PCA and it is solved by the matrix $\mathbf {Q}$ that contains the $K$ dominant singular vectors of $\mathbf {X}$ (i.e., the singular vectors that correspond to the $K$ highest singular values).
The maximization metric in (2) can be expanded as
| $\|\mathbf {X} ^{\top }\mathbf {Q} \|_{1}=\sum _{k=1}^{K}\sum _{n=1}^{N}|\mathbf {x} _{n}^{\top }\mathbf {q} _{k}|.$ | (3) |

## Solution

For any matrix $\mathbf {A} \in \mathbb {R} ^{m\times n}$ with $m\geq n$, define $\Phi (\mathbf {A} )$ as the nearest (in the L2-norm sense) matrix to $\mathbf {A}$ that has orthonormal columns. That is, define
| ${\begin{aligned}\Phi (\mathbf {A} )=&{\underset {\mathbf {Q} \in \mathbb {R} ^{m\times n}}{\text{argmin}}}~~\|\mathbf {A} -\mathbf {Q} \|_{F}\\&{\text{subject to}}~~\mathbf {Q} ^{\top }\mathbf {Q} =\mathbf {I} _{n}.\end{aligned}}$ | (4) |
Procrustes Theorem states that if $\mathbf {A}$ has SVD $\mathbf {U} _{m\times n}{\boldsymbol {\Sigma }}_{n\times n}\mathbf {V} _{n\times n}^{\top }$, then $\Phi (\mathbf {A} )=\mathbf {U} \mathbf {V} ^{\top }$.
Markopoulos, Karystinos, and Pados showed that, if $\mathbf {B} _{\text{BNM}}$ is the exact solution to the binary nuclear-norm maximization (BNM) problem
| ${\begin{aligned}{\underset {\mathbf {B} \in \{\pm 1\}^{N\times K}}{\text{max}}}~~\|\mathbf {X} \mathbf {B} \|_{*}^{2},\end{aligned}}$ | (5) |
then
| ${\begin{aligned}\mathbf {Q} _{\text{L1}}=\Phi (\mathbf {X} \mathbf {B} _{\text{BNM}})\end{aligned}}$ | (6) |
is the exact solution to L1-PCA in (2). The nuclear-norm $\|\cdot \|_{*}$ in (2) returns the summation of the singular values of its matrix argument and can be calculated by means of standard SVD. Moreover, it holds that, given the solution to L1-PCA, $\mathbf {Q} _{\text{L1}}$, the solution to BNM can be obtained as
| ${\begin{aligned}\mathbf {B} _{\text{BNM}}={\text{sgn}}(\mathbf {X} ^{\top }\mathbf {Q} _{\text{L1}})\end{aligned}}$ | (7) |
where ${\text{sgn}}(\cdot )$ returns the $\{\pm 1\}$-sign matrix of its matrix argument (with no loss of generality, we can consider ${\text{sgn}}(0)=1$). In addition, it follows that $\|\mathbf {X} ^{\top }\mathbf {Q} _{\text{L1}}\|_{1}=\|\mathbf {X} \mathbf {B} _{\text{BNM}}\|_{*}$. BNM in (5) is a combinatorial problem over antipodal binary variables. Therefore, its exact solution can be found through exhaustive evaluation of all $2^{NK}$ elements of its feasibility set, with asymptotic cost ${\mathcal {O}}(2^{NK})$. Therefore, L1-PCA can also be solved, through BNM, with cost ${\mathcal {O}}(2^{NK})$ (exponential in the product of the number of data points with the number of the sought-after components). It turns out that L1-PCA can be solved optimally (exactly) with polynomial complexity in $N$ for fixed data dimension $D$, ${\mathcal {O}}(N^{rK-K+1})$.
For the special case of $K=1$ (single L1-PC of $\mathbf {X}$), BNM takes the binary-quadratic-maximization (BQM) form
| ${\begin{aligned}&{\underset {\mathbf {b} \in \{\pm 1\}^{N\times 1}}{\text{max}}}~~\mathbf {b} ^{\top }\mathbf {X} ^{\top }\mathbf {X} \mathbf {b} .\end{aligned}}$ | (8) |
The transition from (5) to (8) for $K=1$ holds true, since the unique singular value of $\mathbf {X} \mathbf {b}$ is equal to $\|\mathbf {X} \mathbf {b} \|_{2}={\sqrt {\mathbf {b} ^{\top }\mathbf {X} ^{\top }\mathbf {X} \mathbf {b} }}$, for every $\mathbf {b}$. Then, if $\mathbf {b} _{\text{BNM}}$ is the solution to BQM in (7), it holds that
| ${\begin{aligned}\mathbf {q} _{\text{L1}}=\Phi (\mathbf {X} \mathbf {b} _{\text{BNM}})={\frac {\mathbf {X} \mathbf {b} _{\text{BNM}}}{\|\mathbf {X} \mathbf {b} _{\text{BNM}}\|_{2}}}\end{aligned}}$ | (9) |
is the exact L1-PC of $\mathbf {X}$, as defined in (1). In addition, it holds that $\mathbf {b} _{\text{BNM}}={\text{sgn}}(\mathbf {X} ^{\top }\mathbf {q} _{\text{L1}})$ and $\|\mathbf {X} ^{\top }\mathbf {q} _{\text{L1}}\|_{1}=\|\mathbf {X} \mathbf {b} _{\text{BNM}}\|_{2}$.

## Algorithms
### Exact solution of exponential complexity

As shown above, the exact solution to L1-PCA can be obtained by the following two-step process:
BNM in (5) can be solved by exhaustive search over the domain of $\mathbf {B}$ with cost ${\mathcal {O}}(2^{NK})$.

### Exact solution of polynomial complexity

Also, L1-PCA can be solved optimally with cost ${\mathcal {O}}(N^{rK-K+1})$, when $r=rank(\mathbf {X} )$ is constant with respect to $N$ (always true for finite data dimension $D$).

### Approximate efficient solvers

In 2008, Kwak proposed an iterative algorithm for the approximate solution of L1-PCA for $K=1$. This iterative method was later generalized for $K>1$ components. Another approximate efficient solver was proposed by McCoy and Tropp by means of semi-definite programming (SDP). Most recently, L1-PCA (and BNM in (5)) were solved efficiently by means of bit-flipping iterations (L1-BF algorithm).

#### L1-BF algorithm

The computational cost of L1-BF is ${\mathcal {O}}(NDmin\{N,D\}+N^{2}K^{2}(K^{2}+r))$.

## Complex data

L1-PCA has also been generalized to process complex data. For complex L1-PCA, two efficient algorithms were proposed in 2018.

## Tensor data

L1-PCA has also been extended for the analysis of tensor data, in the form of L1-Tucker, the L1-norm robust analogous of standard Tucker decomposition. Two algorithms for the solution of L1-Tucker are L1-HOSVD and L1-HOOI.

## Code

MATLAB code for L1-PCA is available at MathWorks.