PCA Classify Example Script: Difference between revisions

From Powers Wiki
(Created page with "== PCA Classify Function == Project new samples into PCA model using appropriate scaling. Xtest = test/second dataset;clsRtest = test/second class. result = PCA mode...")
 
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 11: Line 11:
   scores = T_g2new;
   scores = T_g2new;
   S = boxplot(X_g2new');
   S = boxplot(X_g2new');
[[category:Data_Processing_and_Analysis]]
[[category:Needs_Updating]]<!--This is mostly psuedocode need to clarify to script status-->

Latest revision as of 06:27, 20 January 2022

PCA Classify Function

Project new samples into PCA model using appropriate scaling.

  Xtest = test/second dataset;clsRtest = test/second class.
  result = PCA model (MVApack)  
  mn = result.mean.X;sd = result.scale.X;
  X_g1a = Xtest;%X_g2a = Xtrain;
  X_g2new = (X_g1a-(repmat(mn,[size(X_g1a,1),1])))./(repmat(sd,[size(X_g1a,1),1]));%size(X_g2new)
  T_g2new = X_g2new*result.P;
  scores = T_g2new;
  S = boxplot(X_g2new');