Matlab - processpca内存不足错误

时间:2014-07-08 16:44:35

标签: matlab out-of-memory pca

我必须从processpca矩阵的Neural Network Toolbox(在64位8gb ram机器上)使用400*60000(讲座练习,我认为不能使用其他替代方案)来计算pca )。错误消息是:

Error using eye
Out of memory. Type HELP MEMORY for your options.

Error in processpca.create (line 15)
    settings.transform = eye(R);

Error in processpca (line 60)
[y,settings] = processpca.create(x,param);

Error in pca (line 21)
[trainDataPCA,psPCA] = processpca(trainData);

我的代码是:

% PCA - Reduce feature dimensions to selected dimensions
function [trainDataPCA,trainLabelsPCA] = pca(trainData, trainLabels, nDim)

if nargin < 3 
    print "Exact three arguments needed"
    return
end 

% Reduce nDim to max size of input data
nDimIn = size(trainData,1);
nDimOut = min(nDim,nDimIn);

% Normalise feature  - standard deviation 1, mean 0
trainData = trainData';
trainLabels = trainLabels';
[trainData,trainPS] = mapstd(trainData);

% Calculate PCA
[trainDataPCA,psPCA] = processpca(trainData);
trainDataPCA = trainDataPCA(:,1:nDimOut);

% Map PCA to labels
trainLabelsPCA = processpca('apply',trainLabels,psPCA);
trainLabelsPCA = trainLabelsPCA(:,1:nDimOut);

trainDataPCA = trainDataPCA';
trainLabelsPCA = trainLabelsPCA';

在这种情况下我该怎么办?

编辑:我的记忆:

Maximum possible array:      9861 MB (1.034e+10 bytes) *
Memory available for all arrays:      9861 MB (1.034e+10 bytes) *
Memory used by MATLAB:       680 MB (7.128e+08 bytes)
Physical Memory (RAM):      8187 MB (8.585e+09 bytes)

*  Limited by System Memory (physical + swap file) available.

1 个答案:

答案 0 :(得分:0)

我在完全相同的硬件上使用相同的数据集存在同样的问题。我将其中一个驱动器的Windows虚拟内存大小增加到了[10GB-30GB]范围内。重新启动Windows并运行Matlab后,一切都很好。