主成分分析

From Ufldl

Jump to: navigation, search
Line 36: Line 36:
可以证明,数据变化的主方向 <math>\textstyle u_1</math> 就是协方差矩阵 <math>\textstyle \Sigma</math> 的主特征向量,而 <math>\textstyle u_2</math> 是次特征向量。
可以证明,数据变化的主方向 <math>\textstyle u_1</math> 就是协方差矩阵 <math>\textstyle \Sigma</math> 的主特征向量,而 <math>\textstyle u_2</math> 是次特征向量。
 +
注:如果你对如何得到这个结果的具体数学推导过程感兴趣,可以参看CS229(机器学习)PCA部分的课件(链接在本页底部)。但如果仅仅是想跟上本课,可以不必如此。
-
【初译】:假设<math>\textstyle x</math>的均值为零,那么<math>\textstyle \Sigma</math>就是<math>\textstyle x</math>的协方差矩阵。(符号<math>\textstyle \Sigma</math>,读"Sigma",是协方差矩阵的表示符。虽然看起来与求和符号<math>\sum_{i=1}^n i</math>比较像,但他们是两个不同的概念。)
+
你可以通过标准的数值线性代数运算软件求得特征向量(见实现说明).我们先计算出协方差矩阵<math>\textstyle \Sigma</math>的特征向量,按列排放,而组成矩阵<math>\textstyle U</math>:
-
 
+
-
由此可以得出,数据变化的主方向<math>\textstyle u_1</math>是协方差矩阵<math>\textstyle \Sigma</math>的主特征向量,而<math>\textstyle u_2</math>是次特征向量。
+
-
 
+
-
【一审】:假设<math>\textstyle x</math>的均值为零,那么<math>\textstyle \Sigma</math>就是<math>\textstyle x</math>的协方差矩阵。(符号<math>\textstyle \Sigma</math>,读"Sigma",是协方差矩阵的表示符。虽然看起来与求和符号<math>\sum_{i=1}^n i</math>比较像,但他们是两个不同的概念。)
+
-
 
+
-
可以看出,数据变化的主方向<math>\textstyle u_1</math>是协方差矩阵<math>\textstyle \Sigma</math>的主特征向量,而<math>\textstyle u_2</math>是次特征向量。
+
-
 
+
-
【二审】:假设<math>\textstyle x</math>的均值为零,那么<math>\textstyle \Sigma</math>就是<math>\textstyle x</math>的协方差矩阵。(符号<math>\textstyle \Sigma</math>,读"Sigma",是协方差矩阵的标准符号。虽然看起来与求和符号,如<math>\sum_{i=1}^n i</math>,比较像,但它们是两个不同的概念。)
+
-
 
+
-
可以看出,数据变化的主方向<math>\textstyle u_1</math>,是协方差矩阵<math>\textstyle \Sigma</math>的主特征向量,而<math>\textstyle u_2</math>是次特征向量。
+
-
 
+
-
 
+
-
 
+
-
【原文】:Note: If you are interested in seeing a more formal mathematical derivation/justification of this result, see the CS229 (Machine Learning) lecture notes on PCA (link at bottom of this page). You won't need to do so to follow along this course, however. 
+
-
 
+
-
【初译】:注意:如果你对这个结果更具体的数学推导过程感兴趣,可以参看CS229(机器学习)PCA部分的课件。如果仅仅是想跟上这门课程,可以不必如此。
+
-
 
+
-
【一审】:注意:如果你对这个结果更具体的数学推导过程感兴趣,可以参看CS229(机器学习)PCA部分的课件。如果仅仅是想跟上这门课程,可以不必如此。
+
-
 
+
-
【二审】:注意:如果你对这个结果更具体的数学推导过程感兴趣,可以参看CS229(机器学习)PCA部分的课件(链接在本页底部)。如果仅仅是想跟上这门课程,可以不必如此。
+
-
 
+
-
 
+
-
【原文】:You can use standard numerical linear algebra software to find these eigenvectors (see Implementation Notes).
+
-
Concretely, let us compute the eigenvectors of <math>\textstyle \Sigma</math>, and stack
+
-
the eigenvectors in columns to form the matrix <math>\textstyle U</math>:
+
-
 
+
-
【初译】:特征向量可以通过专业的线性代数运算软件求得。计算出协方差矩阵<math>\textstyle \Sigma</math>的特征向量值后,排成列组成矩阵<math>\textstyle U</math>:
+
-
 
+
-
【一审】:你可以通过标准的线性代数运算软件求得特征向量,在此,就是计算出协方差矩阵<math>\textstyle \Sigma</math>的特征向量值,并将其排成列组成矩阵<math>\textstyle U</math>:
+
-
 
+
-
【二审】:你可以通过标准的线性代数运算软件求得特征向量(见实现说明),在此,让我们计算出协方差矩阵<math>\textstyle \Sigma</math>的特征向量值,并按列排放,组成矩阵<math>\textstyle U</math>:
+
:<math>\begin{align}
:<math>\begin{align}
Line 79: Line 49:
\end{align}</math>
\end{align}</math>
 +
此处, <math>\textstyle u_1</math> 是主特征向量(对应最大的特征值), <math>\textstyle u_2</math> 是次特征向量。以此类推,另记 <math>\textstyle \lambda_1, \lambda_2, \ldots, \lambda_n</math> 为相应的特征值。
-
【原文】:Here, <math>\textstyle u_1</math> is the principal eigenvector (corresponding to the largest eigenvalue),
+
在本例中,向量 <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> 维度上的幅值。
-
<math>\textstyle u_2</math> is the second eigenvector, and so on.
+
-
Also, let <math>\textstyle \lambda_1, \lambda_2, \ldots, \lambda_n</math> be the corresponding eigenvalues.
+
-
 
+
-
【初译】:矩阵中<math>\textstyle u_1</math>是主特征向量(相应于最大的特征值),<math>\textstyle u_2</math>是次特征向量。以此类推,<math>\textstyle \lambda_1, \lambda_2, \ldots, \lambda_n</math>是相应的特征值。
+
-
 
+
-
【一审】:此处,<math>\textstyle u_1</math>是主特征向量(相应于最大的特征值),<math>\textstyle u_2</math>是次特征向量。以此类推,<math>\textstyle \lambda_1, \lambda_2, \ldots, \lambda_n</math>是相应的特征值。
+
-
 
+
-
【二审】:此处,<math>\textstyle u_1</math>是主特征向量(对应最大的特征值),<math>\textstyle u_2</math>是次特征向量。以此类推,<math>\textstyle \lambda_1, \lambda_2, \ldots, \lambda_n</math>是相应的特征值。
+
-
 
+
-
 
+
-
【原文】:The vectors <math>\textstyle u_1</math> and <math>\textstyle u_2</math> in our example form a new basis in which we
+
-
can represent the data.  Concretely, let <math>\textstyle x \in \Re^2</math> be some training example.  Then <math>\textstyle u_1^Tx</math>
+
-
is the length (magnitude) of the projection of <math>\textstyle x</math> onto the vector <math>\textstyle u_1</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>上的幅值。
+
-
 
+
-
【一审】:实例中,向量<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>上的幅值。
+
-
 
+
-
【二审】:在我们的示例中,向量<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>维度上的幅值。
+
-
 
+
-
 
+
-
== Rotating the Data 旋转数据 ==
+
== 旋转数据 ==

Revision as of 15:43, 18 March 2013

Personal tools