PCA.m with data containing NaN (ncnancov.m bug ?)

2 Ansichten (letzte 30 Tage)
Matlab2010
Matlab2010 am 29 Nov. 2013
Kommentiert: Stephen23 am 22 Dez. 2015
I can run the following,
data = randn(2.7E6,79);
[~,score,~,~,explained, ~] = pca(data);
I also have a real data matrix of the same size (79 variables, 2.7E6 observations).
Each row ( i.e. time step) has at least one NaN, in one of the variables. Because of this localSVD.m returns a blank. ie pca.m fails.
I can not replace the NaN with zero as this will change the data (the data is a differenced time series, hence zero means something very different to NaN).
I then try a different approach,
[~,score,~,~,explained, ~] = pca(data,'Algorithm','eig', 'Rows', 'pairwise');
the code fails,
Error using eig
Input to EIG must not contain NaN or Inf.
Error in pca>localEIG (line 441)
[coeff, eigValueDiag] = eig(xCov);
Error in pca (line 308)
[coeff, eigValues] = localEIG(x, vCentered, vRows, vWeights,...
Error in cce_moonShine_L1_PCA (line 28)
[~,score,~,~,explained, ~] = pca(data,'Algorithm','eig', 'Rows', 'pairwise');
I then inspect the cov matrix (79*79)
imagesc(isnan(xCov))
and see that one row/col is NaN. It seems like ncnancov.m is failing as it is outputting with NaN in it?
I also get this when trying,
xCov = nancov(x,'pairwise');
suggestions? How can I carry out PCA on this data?
  1 Kommentar
Stephen23
Stephen23 am 22 Dez. 2015
Eric's "Answer" moved here:
Hello? This just happened to me too. Does anyone from MATHWORKS want to reply?

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Dimensionality Reduction and Feature Extraction finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by