title: Principal component analysis
body: <p>I have to write a classificator (gaussian mixture model) that I use for human action recognition.
  I have 4 dataset of video. I choose 3 of them as training set and 1 of them as testing set.
  Before I apply the gm model on the training set I run the pca on it.</p>
  
  <pre><code>pca_coeff=princomp(trainig_data);
  score = training_data * pca_coeff;
  training_data = score(:,1:min(size(score,2),numDimension));
  </code></pre>
  
  <p>During the testing step what should I do? Should I execute a new princomp on testing data</p>
  
  <pre><code>new_pca_coeff=princomp(testing_data);
  score = testing_data * new_pca_coeff;
  testing_data = score(:,1:min(size(score,2),numDimension));
  </code></pre>
  
  <p>or I should use the pca_coeff that I compute for the training data?</p>
  
  <pre><code>score = testing_data * pca_coeff;
  testing_data = score(:,1:min(size(score,2),numDimension));
  </code></pre>