我想对一个庞大的点数据集进行PCA分析。更具体地说,我的
MATLAB is running out of memory but it should not be
dataPoints
大小为[329150 132]
,其中328150
是数据点的数量,132
是特征数量。我想提取特征向量及其对应的特征值,以便进行PCA重建。但是,当我使用princomp
函数(即[eigenVectors projectedData eigenValues] = princomp(dataPoints);
)时,出现以下错误: Possible Duplicate:MATLAB is running out of memory but it should not be
>> [eigenVectors projectedData eigenValues] = princomp(pointsData);
Error using svd
Out of memory. Type HELP MEMORY for your options.
Error in princomp (line 86)
[U,sigma,coeff] = svd(x0,econFlag); % put in 1/sqrt(n-1) later
然而,如果我使用较小的数据集,我就没有问题。
我该如何在Matlab上对整个数据集执行PCA?有人遇到过这个问题吗?
编辑:
我已经修改了princomp
函数,尝试使用svds
替代svd
,但是,我仍然得到几乎相同的错误。我将错误放在下面:
Error using horzcat
Out of memory. Type HELP MEMORY for your options.
Error in svds (line 65)
B = [sparse(m,m) A; A' sparse(n,n)];
Error in princomp (line 86)
[U,sigma,coeff] = svds(x0,econFlag); % put in 1/sqrt(n-1) later