Вопрос

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?

Это было полезно?

Решение

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);
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top