Implementing PCA/Whitening

From Ufldl

Jump to: navigation, search
m (Changed typo in ZCA whitening code)
Line 19: Line 19:
Finally, you can compute <math>\textstyle x_{\rm rot}</math> and <math>\textstyle \tilde{x}</math> as follows:
Finally, you can compute <math>\textstyle x_{\rm rot}</math> and <math>\textstyle \tilde{x}</math> as follows:
-
  xrot = U' * x;
+
  xrot = U(:,1:k)' * x;   % k is number of eigenvectors to keep
-
  xtilde = U(:,1:k)' * x;
+
  xtilde = U(:,1:k)' * x; % which corresponds to the # dimensions after reduction
 +
                        % set k = size(x, 1) to keep all the eigenvectors
This gives your PCA representation of the data in terms of <math>\textstyle \tilde{x} \in \Re^k</math>.  
This gives your PCA representation of the data in terms of <math>\textstyle \tilde{x} \in \Re^k</math>.  

Revision as of 06:08, 28 April 2011

Personal tools