Principal Component Analysis

I need to write a classifier (model of a Gaussian mixture), which I use to recognize human action. I have 4 video datasets. I choose 3 of them as a set for training and 1 of them as a set of tests. Before applying the gm model on the training set, I ran pca on it.

pca_coeff=princomp(trainig_data);
score = training_data * pca_coeff;
training_data = score(:,1:min(size(score,2),numDimension));

During the testing phase, what should I do? Should I run a new princomp when testing data

new_pca_coeff=princomp(testing_data);
score = testing_data * new_pca_coeff;
testing_data = score(:,1:min(size(score,2),numDimension));

or should i use pca_coeff which i compute for training data?

score = testing_data * pca_coeff;
testing_data = score(:,1:min(size(score,2),numDimension));
+5
source share
1 answer

, . - , , pca_coef.

, , , .

PCA. princomp :

[pca_coeff score eigenvalues] = princomp(data);

eigenvalues , , . :

plot(eigenvalues);

, , ( "Scree Plot", : http://www.ats.ucla.edu/stat/SPSS/output/spss_output_pca_5.gif, 800 12).

, . , , . - Scree "" - , , ~ 0,8, 3 4 .

IIRC, - :

proportion_of_variance = sum(eigenvalues(1:k)) ./ sum(eigenvalues);

" , ".

, , , ; , . Scree , .

+7

All Articles