PCA on high dimensional data
Show older comments
Hello,
I have a matrix X with 13952736 rows x 104 columns, of single data type values. I've been trying to run PCA, with a simple one line code that has worked before, but in return i'm having empty arrays results.
the code can't be simpler: [COEFF, SCORE, LATENT, TSQ , EXPLAINED] = pca (X)
I've also tried asking for less variables, but they also come out empty. [~, ~, LATENT, ~ , EXPLAINED] = pca (X)
So I imagine the problem is related with Matlab memory, but no error message is being displayed. I'm running it in Windows 10 Pro, 16 Gb RAM, i7-8550U processor.
any suggestions?
Thanks
SOLUTION SUMMARY:
Thanks to both Ben and Anton, for stopping by and helping!
It seems the problem was not related with memory, but one of my columns was filled with NaN from top to bottom.
By performing SVD step by step as Anton suggested it allowed me to spot this problems, and by eliminating the faulty column the pca() function worked fine again.
Hope this will help somebody in future.
Best wishes
Ame,
2 Comments
Ben Frankel
on 27 Jul 2018
Edited: Ben Frankel
on 27 Jul 2018
The matrix X should take up about 6 GB of RAM. It depends on what else is in your computer's memory while MATLAB is running, but most likely that should fit in your RAM. Also, I've had MATLAB use too much memory before, but I didn't get unexpected empty results or crashes (my computer's memory just went to swap). The behavior might be different for different functions for all I know, though.
EDIT: Actually, the return values of pca will take up memory, and the temporary variables used in the pca function will take up memory as well. It's definitely possible that you are running out of memory.
Ame ZL
on 27 Jul 2018
Accepted Answer
More Answers (0)
Categories
Find more on Dimensionality Reduction and Feature Extraction in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!