Chapter 7 (Symmetric Matrices and Quadratic Forms): Principal Component Analysis (主成分分析, PCA)

Mean and Covariance

  • To prepare for principal component analysis, let [ X 1 . . . X N ] \begin{bmatrix} \boldsymbol X_1&...& \boldsymbol X_N\end{bmatrix} [X1...XN] be a p × N p\times N p×N matrix of observations (观测矩阵; 每个样本有 p p p 个属性). The sample mean (样本均值), M \boldsymbol M M, of the observation vectors is given by
    在这里插入图片描述
  • For k = 1 , . . . , N k= 1,...,N k=1,...,N, let
    在这里插入图片描述The columns of the p × N p\times N p×N matrix
    在这里插入图片描述have a zero sample mean, and B B B is said to be in mean-deviation form (平均偏差形式).
    在这里插入图片描述
  • The (sample) covariance matrix (样本协方差矩阵) is the p × p p\times p p×p matrix S S S defined by
    在这里插入图片描述The total variance (总方差) of the data is the sum of the variances on the diagonal of S S S. Thus
    在这里插入图片描述
    PROOF
    在这里插入图片描述

下面简单推导一下为什么样本协方差矩阵的系数为 1 n − 1 \frac{1}{n-1} n11 (注意由于是采样,下面式子中的 X ˉ , Y ˉ \bar X,\bar Y Xˉ,Yˉ 其实是随机变量):
E [ ∑ i ( x i − X ˉ ) ( y i − Y ˉ ) ] = E [ ∑ i x i y i − n X ˉ Y ˉ ] = E [ ∑ i x i y i ] − n E [ X ˉ Y ˉ ] = n ( E [ X Y ] − E [ X ˉ Y ˉ ] ) = n ( c o v ( X , Y ) + E [ X ] E [ Y ] − c o v ( X ˉ , Y ˉ ) − E [ X ˉ ] E [ Y ˉ ] ) = n ( c o v ( X , Y ) − c o v ( X ˉ , Y ˉ ) ) ( 1 ) \begin{aligned} E\left[\sum_i(x_i-\bar X)(y_i-\bar Y)\right] &=E\left[\sum_ix_iy_i-n\bar X\bar Y\right] \\&=E\left[\sum_ix_iy_i\right]-nE\left[\bar X\bar Y\right] \\&=n\left(E\left[XY\right]-E\left[\bar X\bar Y\right]\right) \\&=n\left(cov(X,Y)+E[X]E[Y]-cov(\bar X,\bar Y)-E[\bar X]E[\bar Y]\right) \\&=n\left(cov(X,Y)-cov(\bar X,\bar Y)\right)\quad\quad\quad(1) \end{aligned} E[i(xiXˉ)(yiYˉ)]=E[ixiyinXˉYˉ]=E[ixiyi]nE[XˉYˉ]=n(E[XY]E[XˉYˉ])=n(cov(X,Y)+E[X]E[Y]cov(Xˉ,Yˉ)E[Xˉ]E[Yˉ])=n(cov(X,Y)cov(Xˉ,Yˉ))(1)由于假设采样样本之间独立同分布,因此 c o v ( x i , y j ) = 0 ,   i ≠ j cov(x_i,y_j)=0,\ i\neq j cov(xi,yj)=0, i=j,可得
c o v ( X ˉ , Y ˉ ) = 1 n 2 c o v ( ∑ i = 1 n x i , ∑ i = 1 n y i ) = 1 n 2 ∑ i = 1 n ∑ j = 1 n c o v ( x i , y j ) = 1 n 2 ∑ i = 1 n c o v ( x i , y i ) = 1 n c o v ( X , Y ) \begin{aligned} cov(\bar X,\bar Y)&=\frac{1}{n^2}cov\left(\sum_{i=1}^nx_i,\sum_{i=1}^ny_i\right) \\&=\frac{1}{n^2}\sum_{i=1}^n\sum_{j=1}^ncov\left(x_i,y_j\right) \\&=\frac{1}{n^2}\sum_{i=1}^ncov\left(x_i,y_i\right) \\&=\frac{1}{n}cov\left(X,Y\right) \end{aligned} cov(Xˉ,Yˉ)=n21cov(i=1nxi,i=1nyi)=n21i=1nj=1ncov(xi,yj)=n21i=1ncov(xi,yi)=n1cov(X,Y)将上式代入 (1) 得
E [ ∑ i ( x i − X ˉ ) ( y i − Y ˉ ) ] = ( n − 1 ) c o v ( X , Y ) \begin{aligned} E\left[\sum_i(x_i-\bar X)(y_i-\bar Y)\right] &=(n-1)cov(X,Y) \end{aligned} E[i(xiXˉ)(yiYˉ)]=(n1)cov(X,Y)因此
1 n − 1 E [ ∑ i ( x i − X ˉ ) ( y i − Y ˉ ) ] = c o v ( X , Y ) \begin{aligned} \frac{1}{n-1}E\left[\sum_i(x_i-\bar X)(y_i-\bar Y)\right] &=cov(X,Y) \end{aligned} n11E[i(xiXˉ)(yiYˉ)]=cov(X,Y)


  • Analysis of the multivariate data in X 1 , . . . , X N \boldsymbol X_1,..., \boldsymbol X_N X1,...,XN is greatly simplified when most or all of the variables x 1 , . . . , x p x_1,..., x_p x1,...,xp are uncorrelated, that is, when the covariance matrix of X 1 , . . . , X N \boldsymbol X_1,..., \boldsymbol X_N X1,...,XN is diagonal or nearly diagonal. 因此,PCA 的思想就是用正交变换把线性相关变量表示的观测数据转换为少数几个由线性无关变量表示的数据,线性无关的变量称为主成分

PCA

PCA 的基本思想

  • 主成分分析中,首先对给定数据进行规范化,使得数据每一变量的平均值为 0,方差为 1。之后对数据进行正交变换 (也就是对原有坐标系进行旋转变换,得到一个新的坐标系),原来由线性相关变量表示的数据,通过正交变换变成由若干个线性无关的新变量表示的数据 (这些新变量即为新坐标系的正交基)。新变量是可能的正交变换中变量的方差的和 (信息保存) 最大的,方差表示在新变量上信息的大小。将新变量依次称为第一主成分、第二主成分等 (即新坐标系的第一坐标轴、第二坐标轴)
  • 通过主成分分析,可以利用主成分近似地表示原始数据,这可理解为发现数据的 “基本结构”; 也可以把数据由少数主成分表示,这可理解为对数据降维
    在这里插入图片描述

如上图所示,原有坐标系 x 1 , x 2 x_1,x_2 x1,x2,但这两个变量是线性相关的;在经过正交变换后找到了新坐标系 y 1 , y 2 y_1,y_2 y1,y2,原有样本可以由新变量 y 1 , y 2 y_1,y_2 y1,y2 表示,在新坐标系中,数据中的变量 y 1 y_1 y1 y 2 y_2 y2 的是线性无关的。在新坐标系中通过选取方差最大的方向 (第一主成分) 作为新坐标系的第一个坐标轴 y 1 y_1 y1,之后选择与 y 1 y_1 y1 正交且方差次之的方向 (第二主成分) 作为新坐标系的第二坐标轴。如果主成分分析只取第一主成分,即新坐标系的 y 1 y_1 y1 轴,那么等价于将数据投影在椭圆长轴上,将二维空间的数据压缩到一维空间中

对属性进行正交变换,使变换后的属性间互不相关

  • Assume that the matrix [ X 1 . . . X N ] \begin{bmatrix} \boldsymbol X_1&...& \boldsymbol X_N\end{bmatrix} [X1...XN] is already in mean-deviation form. The goal of principal component analysis is to find an orthogonal p × p p\times p p×p matrix P = [ u 1 . . . u p ] P =\begin{bmatrix} \boldsymbol u_1&...& \boldsymbol u_p\end{bmatrix} P=[u1...up] that determines a change of variable, X = P Y \boldsymbol X= P\boldsymbol Y X=PY, or
    在这里插入图片描述with the property that the new variables y 1 , . . . , y p y_1,..., y_p y1,...,yp are uncorrelated and are arranged in order of decreasing variance.
    • Y k \boldsymbol Y_k Yk is the coordinate vector of X k \boldsymbol X_k Xk with respect to the columns of P P P, and Y k = P T X k \boldsymbol Y_k= P^T \boldsymbol X_k Yk=PTXk for k = 1 , . . . , N k= 1,...,N k=1,...,N.
    • Notice that Y 1 , . . . , Y N \boldsymbol Y_1,...,\boldsymbol Y_N Y1,...,YN are in mean-deviation form and the covariance matrix of Y 1 , . . . , Y N \boldsymbol Y_1,...,\boldsymbol Y_N Y1,...,YN is P T S P P^TSP PTSP. So the desired orthogonal matrix P P P is one that makes P T S P P^TSP PTSP diagonal.
  • Let D D D be a diagonal matrix with the eigenvalues λ 1 , . . . , λ p \lambda_1,...,\lambda_p λ1,...,λp of S S S on the diagonal, arranged so that λ 1 ≥ λ 2 ≥ . . . ≥ λ p ≥ 0 \lambda_1\geq\lambda_2\geq...\geq\lambda_p\geq 0 λ1λ2...λp0, and let P P P be an orthogonal matrix whose columns are the corresponding unit eigenvectors u 1 , . . . , u p \boldsymbol u_1,...,\boldsymbol u_p u1,...,up. Then S = P D P T S= PDP^T S=PDPT. (也就是对协方差矩阵 S S S 进行正交对角化) 可以看出, P P P 即为我们想要的正交矩阵,它可以使变换后的变量之间互不相关
    • The unit eigenvectors u 1 , . . . , u p \boldsymbol u_1,...,\boldsymbol u_p u1,...,up of the covariance matrix S S S are called the principal components (主成分) of the data (in the matrix of observations).
      • The first principal component (第一主成分) is the eigenvector corresponding to the largest eigenvalue of S S S, the second principal component is the eigenvector corresponding to the second largest eigenvalue, and so on. (在新坐标系内,样本的协方差矩阵为对角矩阵 D D D,其中第一主成分对应的方差最大,为 D D D 对角线上的第一个元素 λ 1 \lambda_1 λ1;第二主成分对应的方差为 λ 2 \lambda_2 λ2,仅次于第一主成分)
      • The first principal component u 1 \boldsymbol u_1 u1 determines the new variable y 1 y_1 y1 in the following way: Let c 1 , . . . , c p c_1,..., c_p c1,...,cp be the entries in u 1 \boldsymbol u_1 u1. Since u 1 T \boldsymbol u_1^T u1T is the first row of P T P^T PT, the equation Y = P T X \boldsymbol Y= P^T \boldsymbol X Y=PTX shows that
        在这里插入图片描述Thus y 1 y_1 y1 is a linear combination of the original variables x 1 , . . . , x p x_1,..., x_p x1,...,xp, using the entries in the eigenvector u 1 \boldsymbol u_1 u1 as weights (新属性变成了主成分的一个线性组合). In a similar fashion, u 2 \boldsymbol u_2 u2 determines the variable y 2 y_2 y2, and so on.

从互不相关 + 最大化方差的角度看 PCA

  • 最大可分性:在构造新坐标系后降维得到一个超平面时,我们希望样本点在这个超平面上的投影能尽可能分开. 即投影后样本点的方差最大化,这样就可以最大化地保留原有数据的信息;因此我们可以如下构造主成分:给定一个线性变换 y i = u i T x y_i=\boldsymbol u_i^T\boldsymbol x yi=uiTx ( i = 1 , 2 , . . . , p i=1,2,...,p i=1,2,...,p),它们满足下列条件:
    • (1) 系数向量 u i \boldsymbol u_i ui 是单位向量,即 u i T u i = 1 \boldsymbol u_i^T\boldsymbol u_i=1 uiTui=1
    • (2) 变量 y i y_i yi y j y_j yj 互不相关,即 c o v ( y i , y j ) = 0 cov(y_i,y_j) =0 cov(yi,yj)=0 ( i ≠ j i\neq j i=j)
    • (3) 变量 y 1 y_1 y1 x \boldsymbol x x 的所有线性变换中方差最大的; y 2 y_2 y2 是与 y 1 y_1 y1 不相关的 x \boldsymbol x x 的所有线性变换中方差最大的; 一般地, y i y_i yi 是与 y 1 , . . . , y i − 1 y_1,...,y_{i-1} y1,...,yi1 ( i = 1 , 2 , . . . , p i=1 ,2,..., p i=1,2,...,p) 都不相关的 x \boldsymbol x x 的所有线性变换中方差最大的;这时分别称 y 1 , . . . , y p y_1,...,y_p y1,...,yp x \boldsymbol x x 的第一主成分、第二主成分、…、第 p p p 主成分

从上面的条件中也可以推出 PCA


证明

  • The variance of the values of y y y as x \boldsymbol x x varies over the original data x 1 , . . . , x N \boldsymbol x_1,...,\boldsymbol x_N x1,...,xN turns out to be u T S u \boldsymbol u^T S\boldsymbol u uTSu
    • Proof: 1 N − 1 ∑ i = 1 N y i 2 = 1 N − 1 ∑ i = 1 N y i T y i = 1 N − 1 ∑ i = 1 N x i T u u T x i = 1 N − 1 ∑ i = 1 N u T x i x i T u = 1 N − 1 u T ( ∑ i = 1 N x i x i T ) u = 1 N − 1 u T B B T u = u T S u \frac{1}{N-1}\sum_{i=1}^Ny_i^2=\frac{1}{N-1}\sum_{i=1}^Ny_i^Ty_i=\frac{1}{N-1}\sum_{i=1}^N\boldsymbol x_i^T\boldsymbol u\boldsymbol u^T\boldsymbol x_i=\frac{1}{N-1}\sum_{i=1}^N\boldsymbol u^T\boldsymbol x_i\boldsymbol x_i^T\boldsymbol u=\frac{1}{N-1}\boldsymbol u^T(\sum_{i=1}^N\boldsymbol x_i\boldsymbol x_i^T)\boldsymbol u=\frac{1}{N-1}\boldsymbol u^TBB^T\boldsymbol u=\boldsymbol u^T S\boldsymbol u N11i=1Nyi2=N11i=1NyiTyi=N11i=1NxiTuuTxi=N11i=1NuTxixiTu=N11uT(i=1NxixiT)u=N11uTBBTu=uTSu
    • 因此,我们要解的是一个条件最优化问题
      max ⁡ u i u i T S u i s . t .   u i T u i = 1 u i T u j = 0 j = 0 , 1 , . . . , i − 1 c o v ( y i , y j ) = 0 j = 0 , 1 , . . . , i − 1 \begin{aligned} &\max_{\boldsymbol u_i}\boldsymbol u_i^TS\boldsymbol u_i \\s.t.\ &\boldsymbol u_i^T\boldsymbol u_i=1\\ &\boldsymbol u_i^T\boldsymbol u_j=0\quad\quad\quad j=0,1,...,i-1 \\&cov(y_i,y_j)=0\quad j=0,1,...,i-1 \end{aligned} s.t. uimaxuiTSuiuiTui=1uiTuj=0j=0,1,...,i1cov(yi,yj)=0j=0,1,...,i1
  • 我们暂时先忽略约束条件 c o v ( y i , y j ) = 0 cov(y_i,y_j)=0 cov(yi,yj)=0,求解以下条件约束问题:
    max ⁡ u i u i T S u i s . t .   u i T u i = 1 u i T u j = 0 j = 0 , 1 , . . . , i − 1 \begin{aligned} &\max_{\boldsymbol u_i}\boldsymbol u_i^TS\boldsymbol u_i \\s.t.\ &\boldsymbol u_i^T\boldsymbol u_i=1\\ &\boldsymbol u_i^T\boldsymbol u_j=0\quad\quad\quad j=0,1,...,i-1 \end{aligned} s.t. uimaxuiTSuiuiTui=1uiTuj=0j=0,1,...,i1
    • Accoring to Constrained Optimization, the maximum value of the quadratic form u T S u \boldsymbol u^T S\boldsymbol u uTSu, over all unit vectors u \boldsymbol u u, is the largest eigenvalue λ 1 \lambda_1 λ1 of S S S, and this variance is attained when u \boldsymbol u u is the corresponding eigenvector. In the same way, y 2 y_2 y2 has maximum possible variance among all variables y = u T X y=\boldsymbol u^T\boldsymbol X y=uTX that are uncorrelated with y 1 \boldsymbol y_1 y1. Likewise, y 3 \boldsymbol y_3 y3 has maximum possible variance among all variables uncorrelated with both y 1 \boldsymbol y_1 y1 and y 2 \boldsymbol y_2 y2, and so on.
  • 可证得 c o v ( y i , y j ) = u i T S u j cov(y_i,y_j)=\boldsymbol u_i^TS\boldsymbol u_j cov(yi,yj)=uiTSuj,因此我们发现,当 u \boldsymbol u u S S S 的特征向量时, c o v ( y i , y j ) = λ j u i T u j = 0 cov(y_i,y_j)=\lambda_j\boldsymbol u_i^T\boldsymbol u_j=0 cov(yi,yj)=λjuiTuj=0,即正好满足约束 c o v ( y i , y j ) = 0 cov(y_i,y_j)=0 cov(yi,yj)=0,因此得证

因子负荷量 (factor loading)

因子负荷量

  • k k k 个主成分 y k y_k yk 与变量 x i x_i xi 的相关系数 ρ ( y k , x i ) \rho(y_k,x_i) ρ(yk,xi) 称为因子负荷量,它表示第 k k k 个主成分 y k y_k yk 与变量 x i x_i xi 的相关关系。计算公式是
    ρ ( y k , x i ) = λ k u i k σ i i , k , i = 1 , 2 , ⋯   , m \rho\left(y_{k}, x_{i}\right)=\frac{\sqrt{\lambda_{k}} u_{i k}}{\sqrt{\sigma_{i i}}}, \quad k, i=1,2, \cdots, m ρ(yk,xi)=σii λk uik,k,i=1,2,,m其中 λ k \lambda_k λk X X X 协方差矩阵 S S S 的第 k k k 大特征值, u i k u_{ik} uik λ k \lambda_k λk 对应特征向量 u k \boldsymbol u_k uk 的第 i i i 个分量, σ i i \sigma_{ii} σii x i x_i xi 的方差
    • 证明:
      ρ ( y k , x i ) = c o v ( y k , x i ) v a r ( y k ) v a r ( x i ) = c o v ( u k T x , e i T x ) λ k σ i i = u k T S e i λ k σ i i = ( S u k ) T e i λ k σ i i = λ k u k T e i λ k σ i i = λ k u i k σ i i \begin{aligned}\rho\left(y_{k}, x_{i}\right)&=\frac{{cov}\left(y_{k}, x_{i}\right)}{\sqrt{{var}\left(y_{k}\right) {var}\left(x_{i}\right)}} \\&=\frac{{cov}\left( \boldsymbol u_{k}^{\mathrm{T}} \boldsymbol{x}, \boldsymbol e_{i}^{\mathrm{T}} \boldsymbol{x}\right)}{\sqrt{\lambda_{k}} \sqrt{\sigma_{i i}}} \\&=\frac{\boldsymbol u_{k}^{\mathrm{T}}S\boldsymbol e_{i}}{\sqrt{\lambda_{k}} \sqrt{\sigma_{i i}}} \\&=\frac{(S\boldsymbol u_{k})^T\boldsymbol e_{i}}{\sqrt{\lambda_{k}} \sqrt{\sigma_{i i}}} \\&=\frac{\lambda_k\boldsymbol u_{k}^T\boldsymbol e_{i}}{\sqrt{\lambda_{k}} \sqrt{\sigma_{i i}}}\\&=\frac{\sqrt{\lambda_{k}}u_{ik}}{ \sqrt{\sigma_{i i}}} \end{aligned} ρ(yk,xi)=var(yk)var(xi) cov(yk,xi)=λk σii cov(ukTx,eiTx)=λk σii ukTSei=λk σii (Suk)Tei=λk σii λkukTei=σii λk uik

因子负荷量的一些性质

  • (1)
    ∑ i = 1 p σ i i ρ 2 ( y k , x i ) = λ k \sum_{i=1}^p\sigma_{i i}\rho^2\left(y_{k}, x_{i}\right)=\lambda_{k} i=1pσiiρ2(yk,xi)=λk其中 p p p 为样本维数
    • 证明:由因子负荷量的计算式易证,
      σ i i ρ 2 ( y k , x i ) = λ k u i k 2 \sigma_{i i}\rho^2\left(y_{k}, x_{i}\right)=\lambda_{k} u_{i k}^2 σiiρ2(yk,xi)=λkuik2
  • (2)
    ∑ k = 1 p ρ 2 ( y k , x i ) = 1 \sum_{k=1}^p\rho^2\left(y_{k}, x_{i}\right)=1 k=1pρ2(yk,xi)=1
    • 证明:由因子负荷量的计算式可知,
      ρ 2 ( y k , x i ) = λ k u i k 2 σ i i \rho^2\left(y_{k}, x_{i}\right)=\frac{\lambda_{k} u_{i k}^2}{\sigma_{i i}} ρ2(yk,xi)=σiiλkuik2因此
      ∑ k = 1 p ρ 2 ( y k , x i ) = ∑ k = 1 p λ k u i k 2 σ i i = 1 σ i i ∑ k = 1 p λ k u i k T u i k = 1 σ i i ∑ k = 1 p λ k ( u k T e i ) T ( u k T e i ) = 1 σ i i e i T ( ∑ k = 1 p λ k u k u k T ) e i = 1 σ i i e i T S e i = 1 \begin{aligned} \sum_{k=1}^p\rho^2\left(y_{k}, x_{i}\right)&=\frac{\sum_{k=1}^p\lambda_{k} u_{i k}^2}{\sigma_{i i}} \\&=\frac{1}{\sigma_{ii}}\sum_{k=1}^p\lambda_{k} u_{i k}^Tu_{ik} \\&=\frac{1}{\sigma_{ii}}\sum_{k=1}^p\lambda_{k} (\boldsymbol u_k^T\boldsymbol e_i)^T(\boldsymbol u_k^T\boldsymbol e_i) \\&=\frac{1}{\sigma_{ii}}\boldsymbol e_i^T\left(\sum_{k=1}^p\lambda_{k} \boldsymbol u_k\boldsymbol u_k^T\right)\boldsymbol e_i \\&=\frac{1}{\sigma_{ii}}\boldsymbol e_i^TS\boldsymbol e_i \\&=1 \end{aligned} k=1pρ2(yk,xi)=σiik=1pλkuik2=σii1k=1pλkuikTuik=σii1k=1pλk(ukTei)T(ukTei)=σii1eiT(k=1pλkukukT)ei=σii1eiTSei=1

多变量数据的降维

  • It can be shown that an orthogonal change of variables, X = P Y X= PY X=PY, does not change the total variance of the data.
    • It can be shown that if A A A and B B B are n × n n\times n n×n matrices, then t r ( A B ) = t r ( B A ) tr(AB)=tr(BA) tr(AB)=tr(BA)(科学归纳法可证). Thus t r ( P T S P ) = t r ( S ) tr(P^TSP)=tr(S) tr(PTSP)=tr(S).
  • This means that if S = P D P T S = PDP^T S=PDPT , then
    在这里插入图片描述The variance of y j y_j yj is λ j \lambda_j λj, which measures the fraction of the total variance that is “explained” or “captured” by y j y_j yj.
    • 例如,下图中几乎所有点都分布在一个二维平面上,这也就意味着原本的三维坐标可以简化为二维坐标,进而达到降维的目的 (方差最小的那个属性可以去掉)
      在这里插入图片描述

PCA 算法

在这里插入图片描述

  • PCA 仅需保留 W W W 与样本的均值向量 (保存均值向量是为了对新样本同样进行中心化) 即可将新样本投影至低维空间中

选取 d ′ d' d

  • (1) 降维后低维空间的维数 d ′ d' d 通常是由用户事先指定,或通过在 d ′ d' d 值不同的低维空间中对 K K K 近邻分类器(或其他开销较小的学习器)进行交叉验证来选取较好的 d ′ d' d
  • (2) 对 PCA, 还可从重构的角度设置一个重构阈值,例如 t = 95 % t = 95\% t=95%, 然后选取使下式成立的最小 d ′ d' d 值 (将方差看作信息的保留程度;特征值之和即为总方差;下式保证降维后的数据总方差占原数据总方差的 t t t 以上):
    在这里插入图片描述
    • 显然,低维空间与原始高维空间必有不同,因为对应于最小的 d − d ′ d -d' dd 个特征值的特征向量被舍弃了
    • 但舍弃这部分信息往往是必要的: 一方面,舍弃这部分信息之后能使样本的采样密度增大,这正是降维的重要动机;另一方面,当数据受到噪声影响时,最小的特征值所对应的特征向量往往与噪声有关,将它们舍弃能在一定程度上起到去噪的效果
  • (3) 重构阈值反映了主成分保留信息的比例,但它不能反映对某个原有变量 x i x_i xi 保留信息的比例,这时通常利用 k k k 个主成分的 y 1 , . . . , y k y_1,...,y_k y1,...,yk 对原有变量 x i x_i xi 的贡献率
    在这里插入图片描述

数据矩阵的奇异值分解算法

  • 实践中常通过 X X X 进行奇异值分解来代替协方差矩阵的特征值分解
    在这里插入图片描述

在这里插入图片描述

Example: Multichannel Image Processing

  • 卫星拍摄了同一地区的 3 个不同波段的照片,这 3 张照片中含有许多冗余信息,但也各自包含一些独特的信息。我们的目标就是从这些照片中和抽取出有用信息,最终合成一张图片
    在这里插入图片描述

  • 首先,我们将每个像素点都看作一个样本点,因此 2000 × 2000 2000\times 2000 2000×2000 的图片就可以看作 2000 × 2000 2000\times 2000 2000×2000 个样本,同时每个样本有 3 个属性 (3 张照片中对应像素点的取值)。最终观测矩阵大小为 3 × 4000 , 000 3\times4000,000 3×4000,000
  • 假设样本协方差矩阵为:
    在这里插入图片描述
    • The eigenvalues of S S S and the associated principal components (the unit eigenvectors) are
      在这里插入图片描述Using two decimal places for simplicity, the variable for the first principal component is
      在这里插入图片描述This equation was used to create photograph ( d ) (d) (d). The variables x 1 , x 2 x_1, x_2 x1,x2, and x 3 x_3 x3 are the signal intensities in the three spectral bands. At each pixel in photograph ( d ) (d) (d), the gray scale value is computed from y 1 y_1 y1, a weighted linear combination of x 1 , x 2 x_1, x_2 x1,x2 and x 3 x_3 x3. In this sense, photograph ( d ) (d) (d) “displays” the first principal component of the data.
      在这里插入图片描述
  • The covariance matrix for the transformed data, using variables y 1 , y 2 y_1, y_2 y1,y2, and y 3 y_3 y3, is
    在这里插入图片描述在这里插入图片描述The percentages of the total variance explained by the principal components are
    在这里插入图片描述The calculations in show that the data have practically no variance in the third (new) coordinate. (新的第 3 坐标上,所有样本属性取值都几乎相同 (方差很小),因此该坐标上保留的信息很少,可以删除) In fact, y 2 y_2 y2 also has relatively small variance, which means that the points lie approximately along a line, and the data are essentially one-dimensional.
    在这里插入图片描述

References

  • L i n e a r Linear Linear a l g e b r a algebra algebra a n d and and i t s its its a p p l i c a t i o n s applications applications
  • 《统计学习方法》
  • 《机器学习》(周志华)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值