Pergunta

Can someone please either confirm or correct this Wikipedia algorithm for computing the first principal component? I want a simple implementation of PCA in D, which doesn't have any existing libraries for PCA AFAIK. I've tried implementing this, and it doesn't seem like my results on simple examples match stuff I get from R or Octave. I'm pretty sure it's not an implementation bug because I've checked over my implementation several times and even rewritten it from scratch, and it's a pretty simple algorithm.

Foi útil?

Solução

Is your data matrix is zero meaned, as required by the pre-conditions?

The code snippet is unclear on this point, but the way that the data matrix is originally described, I think that the column means need to be zero for the power method to work.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top