how to resolve the error

4 visualizaciones (últimos 30 días)
ajith
ajith el 13 de Nov. de 2013
Editada: Walter Roberson el 3 de Feb. de 2025 a las 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

Respuestas (1)

Aditya
Aditya el 3 de Feb. de 2025 a las 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.

Categorías

Más información sobre Dimensionality Reduction and Feature Extraction en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by