Wie Projekt ein neues Punkt-zu-PCA neue basis?

Zum Beispiel habe ich 9 Variablen und 362 Fällen. Ich habe die PCA-Berechnung, und fand heraus, dass die ersten 3 PCA-Koordinaten sind genug für mich.

Nun, ich habe neue Punkt in meinem 9-dimensionale Struktur, und ich will-Projekt zur principal component system koordinieren. Wie man den neuen Koordinaten?

%# here is data (362x9)
load SomeData

[W, Y] = pca(data, 'VariableWeights', 'variance', 'Centered', true);

%# orthonormal coefficient matrix
W = diag(std(data))\W;

% Getting mean and weights of data (for future data)
[data, mu, sigma] = zscore(data);
sigma(sigma==0) = 1;

%# New point in original 9dim system
%# For example, it is the first point of our input data
x = data(1,:);
x = bsxfun(@minus,x, mu);
x = bsxfun(@rdivide, x, sigma);

%# New coordinates as principal components
y0 = Y(1,:); %# point we should get in result
y = (W*x')'; %# our result

%# error
sum(abs(y0 - y)) %# 142 => they are not the same point

%# plot
figure()
plot(y0,'g'); hold on;
plot(y,'r');

Wie Projekt ein neues Punkt-zu-PCA neue basis?

Wie man Koordinaten für einen neuen Punkt projiziert, um neue principal component Grundlage?

  • Haben Sie irgendwelche Unterlagen für die pca() Funktion? Normalerweise in matlab nutze ich princomp().
  • Sind Y(1,:) und y in die gleiche Richtung?
  • Nun, ich versuche in einer neuen version von Matlab. Es Funktion princomp() weitergeleitet wird pca(). Ok, ich werde versuchen, die in älteren Versionen, die sich alle um so mehr, als ich brauche, um im alten Matlab
  • ja, beide Y(1,:) und y sind 1x9.
  • Richtung, nicht in der dimension. Ist Y(1,:) etwa ein Vielfaches von y?
  • sorry, falsch verstanden. Ich habe meinen Beitrag aktualisiert

Schreibe einen Kommentar