100 likes | 297 Views
Principal Component Analysis. Principal Component Analysis. Objective: Project the data onto a lower dimensional space while minimizing the information loss. Principal Component Analysis. load mnist m = mean(data); for i= 1:size ( data_m,2 ) data_m (:,i) = data(:, i) - m(i); end
E N D
Principal Component Analysis Objective: Project the data onto a lower dimensional space while minimizing the information loss
Principal Component Analysis load mnist m = mean(data); for i=1:size(data_m,2) data_m(:,i) = data(:,i) - m(i); end [pc,evals] = pca_OF(data_m); pc_data = data_m*pc(1:200,:)';
Principal Component Analysis function [pc,evals] = pca_OF(x) [pc,evals] = eig(cov(x)); evals = diag(evals); [evals, si] = sort(-evals); %Sort eigenvalues evals = -evals; pc = pc(:,si)'; %Sort eigenvectors by magnitude of eigenvalues