how to resolve the error

조회 수: 4 (최근 30일)
ajith
ajith 2013년 11월 13일
편집: Walter Roberson 2025년 2월 3일 4:54
[pc,score,latent,tsquare] = princomp(x); red_dim = score(:,1:50);
??? Error using ==> svd Out of memory. Type HELP MEMORY for your options.
Error in ==> princomp at 85 [U,sigma,coeff] = svd(x0,econFlag); % put in 1/sqrt(n-1) later
MY x value consist 50x36033 i need to use feature reduction

답변 (1개)

Aditya
Aditya 2025년 2월 3일 4:31
Hi Ajith,
The error you're encountering is due to memory limitations when trying to perform Singular Value Decomposition (SVD) on a large matrix using princomp. Since princomp is deprecated and you have a large dataset, it's better to use pca, which is more efficient and offers better handling of large datasets.
% Assume X is your data matrix with observations in rows and variables in columns
% In your case, X is 50x36033
% Perform PCA
[coeff, score, latent, tsquared, explained, mu] = pca(X, 'NumComponents', 50);
% score contains the reduced dimensions (50x50)
% coeff contains the principal component coefficients
% latent contains the eigenvalues
% tsquared contains Hotelling's T-squared statistic
% explained contains the percentage of total variance explained by each component
% mu contains the estimated mean of each variable
% Extract the reduced dimensions
red_dim = score; % This will be 50x50
% If you need to transform new data into the reduced space, use:
% new_data_transformed = (new_data - mu) * coeff(:, 1:50);
Using pca instead of princomp should help you perform PCA more efficiently on large datasets and reduce the dimensionality to the desired number of components.

카테고리

Help CenterFile Exchange에서 Dimensionality Reduction and Feature Extraction에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by