how to resolve the error
4 ビュー (過去 30 日間)
古いコメントを表示
[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
0 件のコメント
回答 (1 件)
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.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!