主成分分析

From Ufldl

Jump to: navigation, search
Line 166: Line 166:
Similarly, <math>\textstyle u_2^Tx</math> is the magnitude of <math>\textstyle x</math> projected onto the vector <math>\textstyle u_2</math>.
Similarly, <math>\textstyle u_2^Tx</math> is the magnitude of <math>\textstyle x</math> projected onto the vector <math>\textstyle u_2</math>.
-
【初译】:
+
【初译】:实例中,向量<math>\textstyle u_1</math>和<math>\textstyle u_2</math>形成了一个我们可以表示数据的新数据基。令<math>\textstyle x \in \Re^2</math>是训练样本,那么<math>\textstyle u_1^Tx</math>就是样本点<math>\textstyle x</math>到向量<math>\textstyle u_1</math>上的长度(幅值)。类似的,<math>\textstyle u_2^Tx</math>是<math>\textstyle x</math>到向量<math>\textstyle u_2</math>上的幅值。
【一审】:
【一审】:
Line 185: Line 185:
<math>\textstyle x_{\rm rot}</math>, we get:  
<math>\textstyle x_{\rm rot}</math>, we get:  
-
【初译】:
+
【初译】:因此,我们可以计算出以<math>\textstyle (u_1, u_2)</math>为基的<math>\textstyle x</math>的映射表示。
 +
:<math>\begin{align}
 +
x_{\rm rot} = U^Tx = \begin{bmatrix} u_1^Tx \\ u_2^Tx \end{bmatrix}
 +
\end{align}</math>
 +
(下标“rot”来源于单词“rotation”,意指这是原数据经过旋转(也可以说成映射)得到后得到的结果)数据集中的每个数据<math>\textstyle i</math>经过<math>\textstyle x_{\rm rot}^{(i)} = U^Tx^{(i)}</math>计算后,可以画出如下映射数据<math>\textstyle x_{\rm rot}</math>图:
 +
 
【一审】:
【一审】:
Line 208: Line 213:
because <math>\textstyle U x_{\rm rot} =  UU^T x = x</math>.
because <math>\textstyle U x_{\rm rot} =  UU^T x = x</math>.
-
【初译】:
+
【初译】:这就是训练数据集旋转到以<math>\textstyle u_1</math>,<math>\textstyle u_2</math>为基后的数据。但是通常情况下,训练数据集合通过<math>\textstyle U^Tx</math>旋转后会得到的是<math>\textstyle n</math>维的<math>\textstyle u_1</math>,<math>\textstyle u_2</math>, ...,<math>\textstyle u_n</math>。由于矩阵<math>\textstyle U</math>具有正交性,也就是说它满足<math>\textstyle U^TU = UU^T = I</math>,所以假若想从<math>\textstyle x_{\rm rot}</math>中还原<math>\textstyle x</math>,可以通过如下计算:
 +
 
 +
:<math>\begin{align}
 +
x = U x_{\rm rot}  ,
 +
\end{align}</math>
 +
 
 +
因为<math>\textstyle U x_{\rm rot} =  UU^T x = x</math>
【一审】:
【一审】:
Line 221: Line 232:
reduce this data to one dimension, we can set  
reduce this data to one dimension, we can set  
-
【初译】:
+
【初译】:数据变化的主方向相应于旋转数据的第一维<math>\textstyle x_{{\rm rot},1}</math>。因此,如若想把数据降到一维,我们仅需令:
【一审】:
【一审】:
Line 236: Line 247:
the top <math>\textstyle k</math> directions of variation.  
the top <math>\textstyle k</math> directions of variation.  
-
【初译】:
+
【初译】:一般情况下,假如想把<math>\textstyle x \in \Re^n</math>的数据降到<math>\textstyle k</math>维,即<math>\textstyle \tilde{x} \in \Re^k</math>(<math>\textstyle k < n</math>),需要选取<math>\textstyle x_{\rm rot}</math>的前<math>\textstyle k</math>个成分,其相应于变量的前<math>\textstyle k</math>个主方向。
【一审】:
【一审】:
Line 250: Line 261:
<math>\textstyle x_{{\rm rot},2}^{(i)} = u_2^Tx^{(i)}</math> was more likely to be small).   
<math>\textstyle x_{{\rm rot},2}^{(i)} = u_2^Tx^{(i)}</math> was more likely to be small).   
-
【初译】:
+
【初译】:PCA的另外一种解释是:<math>\textstyle x_{\rm rot}</math>是一个<math>\textstyle n</math>维的向量,其中前面几维比较大(例如,上例中对于大部分的样本<math>\textstyle i</math>通过<math>\textstyle x_{{\rm rot},1}^{(i)} = u_1^Tx^{(i)}</math>计算出了比较大的值),后面几维可能会比较小(例如,上例中<math>\textstyle x_{{\rm rot},2}^{(i)} = u_2^Tx^{(i)}</math>计算出了值较小)。
【一审】:
【一审】:
Line 290: Line 301:
In our example, this gives us the following plot of <math>\textstyle \tilde{x}</math> (using <math>\textstyle n=2, k=1</math>):
In our example, this gives us the following plot of <math>\textstyle \tilde{x}</math> (using <math>\textstyle n=2, k=1</math>):
-
【初译】:而PCA算法就是丢弃x_(rot )中后面的(较小的)成分,把他们赋值为零。更直观的说就是, 也可以用 的除了前k个成分,其余全赋值为零来表示。换句话说就是,我们可以运用如下算式:
+
【初译】:而PCA算法就是丢弃<math>\textstyle x_{\rm rot}</math>中后面的(较小的)成分,把他们赋值为零。更直观的说就是,<math>\textstyle \tilde{x}</math>也可以用<math>\textstyle x_{{\rm rot}}</math>的除了前<math>\textstyle k</math>个成分,其余全赋值为零来表示。换句话说就是,我们可以运用如下算式:
:<math>\begin{align}
:<math>\begin{align}
\tilde{x} =  
\tilde{x} =  
Line 313: Line 324:
\end{align}</math>
\end{align}</math>
-
在我们的实验中,得到了如下的 的图形(取 ):
+
在我们的实验中,得到了如下的<math>\textstyle \tilde{x}</math>的图形(取<math>\textstyle n=2, k=1</math>):
【一审】:
【一审】:

Revision as of 21:08, 11 March 2013

Personal tools