Mercurial > hg > machine-learning-hw7
view pca.m @ 6:6d94b2bafcd1 default tip
Replace complicated memory-intensive operation with a faster loop
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Tue, 06 Dec 2011 11:49:32 -0500 |
parents | 069653867b3b |
children |
line wrap: on
line source
function [U, S] = pca(X) ##PCA Run principal component analysis on the dataset X ## [U, S, X] = pca(X) computes eigenvectors of the covariance matrix of X ## Returns the eigenvectors U, the eigenvalues (on diagonal) in S ## [U, S, ~] = svd (X'*X/rows (X)); endfunction