# A Generic Block-Level Error Confinement Technique for Memory Based on Principal Component Analysis
## 2 Background  
### Principal Component Analysis  
Principal component analysis (PCA) was first proposed in 1901 [15], and was later developed in several different works during the last decades. It was popularized in computer vision by the eigen faces method [16], a face recognition model still relevant and used in current days. Given a set of samples, PCA yields a set of orthonormal vectors that can be used to linearly project the samples into a new space. This space maximizes the variance of projected samples and minimizes their least mean square error, that is, it minimizes the difference between the projected sample and its reconstruction back to the original space [17]. This characteristic makes PCA suitable for reduction of dimensionality. The data comes from many kinds of sources, such as images [18]. The process of dimensionality reduction is as follows [19]. The dataset matrix X of dimension m \(\times\) n, is given with real entries. The column vectors of matrix X are indexed as [x\({}_{1}\),x\({}_{2}\),...,x\({}_{n}\)] and contain m real scalars in each column vector. \[X=[x_{1}\ x_{2}\ \cdots x_{n}]=\left[ \begin{array}{cccc}x_{11}&x_{12}& \cdots&x_{1n}\\ x_{21}&x_{22}&\cdots&x_{2n}\\ \vdots&\vdots&\ddots&\vdots\\ x_{m1}&x_{m2}&\cdots&x_{mn}\end{array} \right] \tag{1}\]  
The input dataset must be centered to make the mean equal to 0 for all the column vectors of the input data matrix X. The centering of the data is advantageous as it minimizes the sum of squared errors and removes undesirable fluctuations. The mean centering process is accomplished by subtracting the mean mu\({}_{1}\) of each individual column vector x\({}_{i}\) for i = 1, 2,..., n from each element of the individual column vector. The mean centering process can be shown for i-th column vector as:  
\[\mu_{i}=\frac{\int_{k=1}^{m}x_{ik}}{m} \tag{2}\]  
subtracting the mean from column vector x\({}_{i}\),  
\[x_{i}=x_{i}-\mu_{i}=\left[ \begin{array}{c}x_{1i}-\mu_{i}\\ x_{2i}-\mu_{i}\\ \vdots\\ x_{mi}-\mu_{i}\end{array} \right] \tag{3}\]  
where the column vector x\({}_{1}\) is now a zero-mean centered vector. The matrix X is transformed to have zero mean centered column vectors,  
\[X=\left[ \begin{array}{cccc}x_{11}-\mu_{1}&x_{12}-\mu_{2}&\cdots&x_{1n}-\mu_ {n}\\ x_{21}-\mu_{1}&x_{22}-\mu_{2}&\cdots&x_{2n}-\mu_{n}\\ \vdots&\vdots&\ddots&\vdots\\ x_{m1}-^{-}_{1}&x_{m2}-\mu_{2}&\cdots&x_{mm}-\mu_{n}\end{array} \right] \tag{4}\]  
After the process of mean centering, matrix X is used to calculate the covariance matrix S and normalize the covariance matrix S:  
\[S=\frac{X^{T}X}{m-1} \tag{5}\]  
where the covariance matrix S has the dimension of n * n and is a symmetric matrix. There are two features about the covariance matrix S, for i, j = 1, 2,..., m [20]:  
All the main diagonal entries of the covariance matrix S, such as s\({}_{ii}\) are the variance of the i-th diagonal element of the matrix X. All off-diagonal entries of the covariance matrix S, such as s\({}_{ij}\) where i \(\
eq\) j, are the covariance between the i-th and j-th entries of the matrix X. Analysis of the multivariate dataset can be simplified when most or all the elements in the covariance matrix S are uncorrelated. It indicates the covariance matrix should be diagonal or nearly diagonal. The similar simplification can be applied to PCA, with an orthogonal square matrix of size n * n. If the covariance matrix S with eigenvalues of \(\lambda\)\({}_{1}\), \(\lambda\)\({}_{2}\)..., \(\lambda\)\({}_{n}\) and diagonal matrix \(\wedge\) has equal entries arranged as \(\lambda\)\({}_{1}\)\(\geq\)\(\lambda\)\({}_{2}\)\(\geq\)\(...\)\(\geq\)\(\lambda\)\({}_{n}\) in its diagonal, and there is an orthogonal matrix V, whose columns are the corresponding unit eigenvectors v \({}_{1}\), v \({}_{2}\),..., v \({}_{n}\), then S = V\(\wedge\)V\({}^{T}\) and \(\wedge\) = V\({}^{T}\)SV [21]. The diagonalization process of the covariance matrix can be accomplished using Eigen decomposition.