Principal Component Analysis (PCA) is a technique used to simplify complex datasets.
主成分分析(PCA)は、複雑なデータセットをシンプルにするための手法です。
Datasets we often encounter in data analysis, such as genetics, marketing, or face recognition, are represented by many variables. You can think of them as points in a high-dimensional space. Because it is difficult to understand and process such complex data, we often want to reduce the dimensionality by projecting the data onto a lower-dimensional space.
データ分析で扱うデータは、遺伝子、マーケティング、顔認識などのように、多くの場合、数多くの変数で表された、高次元空間における点の集まりとして捉えることができます。こうした複雑なデータは理解や処理が難しいため、より低い次元の空間に射影して「次元を減らす」ことがよく行われます。
Imagine a cloud of points in 3D space. If you view them from a single viewpoint and trace them onto paper or glass, you create a picture of the points on a 2D plane. To make the data easier to interpret, you would want to choose an angle that best captures the main characteristics of the distribution. We can debate what “best” means, but a common approach is to find the angle where the projected points are most spread out.
3次元空間に、雲のように散らばった点の集まりを想像してください。これを1つの視点から眺め、紙やガラスに写し取ると、点は2D平面上の図になります。データを解釈しやすくするには、分布の主な特徴を最もよく捉える角度を選びたいはずです。「何が最良か」は議論の余地がありますが、よく用いられるのは、写し取った点が最もばらばらに広がる角度を探すことです。
This is the basic idea of PCA. It finds the most important (principal) direction (component) that best captures the data.
この、データを表現するうえで最適な方向(主成分)を見つけることが、PCAの基本的なアイデアです。
射影の数式**
To understand the math, let’s think about points on a 2D plane that we project onto a line.
数式で理解するために、2D 平面上の点を 1 本の直線へ射影する状況を考えます。
$p_i$ is a data point, and $v$ is a unit vector representing the direction of the line. The projection of $p_i$onto the line is given by:
$p_i$ をデータに含まれる点、$v$ を直線の向きを表す単位ベクトルとします。$p_i$ をその直線に射影した下のように表されます。
$\tilde{p}_i = (p_i \cdot v)v$
The variance of the projected points is the average of the squared values (assuming the data is centered at zero):