为什么对一些矩阵做PCA得到的矩阵少一行?

本文通过形象解释PCA过程,揭示了将N*M矩阵降维到M*(M-1)矩阵的原因。从PCA的三个基本步骤出发,分析了数据坐标系的重新构建和主成分的选择过程,特别是如何确定第二主成分的方向,从而理解为什么在二维数据中只能得到一条线作为最大变异方向。

很多时候会出现把一个N*M的矩阵做pca(对M降维)之后却得到一个M*(M-1)矩阵这样的结果。之前都是数学推导得到这个结论,但是,

今天看到一个很形象的解释:

Consider what PCA does. Put simply, PCA (as most typically run) creates a new coordinate system by (1) shifting the origin to the centroid of your data, (2) squeezes and/or stretches the axes to make them equal in length, and (3) rotates your axes into a new orientation. (For more details, see this excellent CV thread: Making sense of principal component analysis, eigenvectors & eigenvalues.) However, it doesn't just rotate your axes any old way. Your new X1 (the first principal component) is oriented in your data's direction of maximal variation. The second principal component is oriented in the direction of the next greatest amount of variation that is orthogonal to the first principal component. The remaining principal components are formed likewise.

With this in mind, let's examine @amoeba's example. Here is a data matrix with two points in a three dimensional space:

X=[121212]

Let's view these points in a (pseudo) three dimensional scatterplot:

 

enter image description here

So let's follow the steps listed above. (1) The origin of the new coordinate system will be located at (1.5,1.5,1.5). (2) The axes are already equal. (3) The first principal component will go diagonally from (0,0,0) to (3,3,3), which is the direction of greatest variation for these data. Now, the second principal component must be orthogonal to the first, and should go in the direction of the greatestremaining variation. But what direction is that? Is it from (0,0,3) to (3,3,0), or from (0,3,0) to (3,0,3), or something else? There is no remaining variation, so there cannot be any more principal components.

With N=2 data, we can fit (at most) N1=1 principal components.

转载于:https://www.cnblogs.com/sciencefans/p/4567455.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值