【问题标题】:How to get the number of significant Eigen Value?如何获得显着特征值的数量?
【发布时间】:2014-02-17 16:14:04
【问题描述】:

我正在使用 Matlab 计算 PCA。我已经计算了特征值和特征向量。

我使用了这个 matlab 函数:

     [Eigen Vector, Eigen Value]=eigs(Matrix,k);

通过这个 eigs 函数,我们将得到有序的特征值(从大到小)。

在这种情况下,我将确定 k(这是我想要保留的特征值的数量)。

我需要用这个公式计算 k:

   Σ(from 1 to p) of eigen value
   ------------------------------------------------------- * 100 = our persentage
   Σ(from 1 to col of eigen value matrix) of eigen value

其中 k=p

为了减少输入矩阵的维度,我只需要:

     (Eigen Vector*Eigen Value*Eigen Vector')

有人知道是否有matlab函数可以根据我们想要的百分比来获取k数??

【问题讨论】:

    标签: matlab matrix pca


    【解决方案1】:

    您可以使用cumsum

    您可能想在求和之前取特征值的绝对值:

    P = 90; %// desired percentage
    eigenValues = eigs(Matrix);
    summation = cumsum(abs(eigenValues));
    summation = summation/summation(end)*100; %// normalize to get percentage
    k = find(summation>=P,1); %// first index for whith P is exceeded
    

    【讨论】:

      猜你喜欢
      • 2018-08-06
      • 1970-01-01
      • 1970-01-01
      • 2010-10-03
      • 2014-02-11
      • 1970-01-01
      • 1970-01-01
      • 2014-06-03
      • 2021-11-05
      相关资源
      最近更新 更多