I have to calculate a pca using processpca
(lecture excercise, not able to user alternatives here I think) from the Neural Network Toolbox
of a 400*60000
matrix (on a 64bit 8gb ram machine). The error message is:
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);
My code is:
% 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';
What can I do in this situation?
EDIT: My memory:
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.