0
$\begingroup$

I have a training set of dimensions 126 x 5 (126 rows and 5 columns). I applied PCA on it and decided to keep the first 2 PCs. So I now have a matrix (say FeatureVector) of dimensions (126 x 2) onto which I want to project my training set scaled and normalized (say DataAdjust).

The source(page 16) I've found say to do this:

FinalData = T(FeatureVector) x T(DataAdjust)

but this would mean (multiplying dimensions): (2 x 126) x ( 5 x 126) which is not doable in matrix multiplications. Also, I think I should be getting a 126 x 2 matrix as FinalData.

EDIT: SOLVED

My confusion came from the fact that I computed the principal component analysis with the PCA function from FactoMineR which already gives the training set projected onto the PCs space in the res_pca$ind$coord variable. I manually calculated the eigenvectors of the covariance matrix of my dataset and applying, with these vectors, the bold formula above I got exactly the matrix res_pca$ind$coord.

$\endgroup$

1 Answer 1

1
$\begingroup$

If your data consists of 126 measurements, each with five variables, and you feed this 126 x 5 matrix to PCA, and you ask PCA for two PCs, PCA will compute those two PCs, i.e. two vectors of dimension five. When you project your data onto those two PCs, you will get, for each of your 126 measurements, a two-dimensional vector, i.e., all together, a matrix of shape 126 x 2.

So, while I don't know your code and all this is guess work, chances are, this 126 x 2 matrix you have there is already the collection of the projections of your data to the PCs.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.