Reputation: 1
I am applying PCA on a dataset consist of 2340 (label excluded) features and 2245 records (2245X2340 double matrix), to reduce its high dimensionality and to select at least 50 features for further classification process with the following codes on Matlab:
[coeff,score,~,~,~,mu] = pca(X);
save("coeff.mat","coeff");
reducedDimension = coeff(:,1:50);
reducedData = X * reducedDimension;
but at first line on breakpoint it just returns coeff and score empty:
and when reaches to third line stops with this error:
Where is the problem? Secondly is this way of using PCA (code above) true for dimensionality reduction?
dataset was a bit large so i just posted screenshot of a portion of it:
Upvotes: 0
Views: 856
Reputation: 832
It is because you have NANs in your dataset. First you have to convert your NANs to numeric values so that the numeric behaviour of the data will be remain constant. To do this, just add the following line in your code before applying PCA:
data(isnan(data))=0;
This will assign 0 to all the NANs values
Upvotes: 0