Pregunta

For certain measurements i need to obtain only the numeric value of the first principal component from the matrix. Can someone please tell me how do i go about it?

¿Fue útil?

Solución

the most straight forward way is just to get the top eigenvector/value of your data's covariance matrix using eigs

say the data matrix x is N by D, or # of data by dimension of data

you can simply do

C = cov(X);
[V, D] = eigs(C, 1);

in fact, you can get the top k principal components by running

[V, D] = eigs(C, k);
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top