From Wikimization
(Difference between revisions)


Line 1: 
Line 1: 
  == Singular Value Decomposition <i>versus</i> Principal Component Analysis ==
 +  #REDIRECT [[Singular Value Decomposition <i>versus</i> Principal Component Analysis]] 
   +  
  from <i>SVD meets PCA</i>, slide by Cleve Moler
 +  
   +  
  “''The Wikipedia pages on SVD and PCA are quite good and contain a number of useful links, although not to each other.''”
 +  
  <br>[https://www.mathworks.com/company/newsletters/articles/professorsvd.html <math></math>MATLAB News & Notes, Cleve’s Corner, 2006]
 +  
   +  
  <pre>
 +  
  %relationship of pca to svd
 +  
  m=3; n=7;
 +  
  A = randn(m,n);
 +  
   +  
  [coef,score,latent] = pca(A)
 +  
   +  
  X = A  mean(A);
 +  
  [U,S,V] = svd(X,'econ');
 +  
   +  
  % S vs. latent
 +  
  rho = rank(X);
 +  
  latent = diag(S(:,1:rho)).^2/(m1)
 +  
   +  
  % U vs. score
 +  
  sense = sign(score).*sign(U*S(:,1:rho)); %account for negated left singular vector
 +  
  score = U*S(:,1:rho).*sense
 +  
   +  
  % V vs. coef
 +  
  sense2 = sign(coef).*sign(V(:,1:rho)); %account for corresponding negated right singular vector
 +  
  coef = V(:,1:rho).*sense2
 +  
  </pre>
 +  
Revision as of 17:24, 12 September 2018
 REDIRECT [[Singular Value Decomposition versus Principal Component Analysis]]