truepca.m

来自「用EM算法估计PCA参数」· M 代码 · 共 28 行

M
28
字号
function [evects,evals] = truepca(dataset)% [evects,evals] = truepca(dataset)%% USUAL WAY TO DO PCA -- find sample covariance and diagonalize%% input: dataset % note, in dataset, each COLUMN is a datapoint% the data mean will be subtracted and discarded% % output: evects holds the eigenvectors, one per column%         evals holds the corresponding eigenvalues%[d,N]  = size(dataset);mm = mean(dataset')';dataset = dataset - mm*ones(1,N);cc = cov(dataset',1);[cvv,cdd] = eig(cc);[zz,ii] = sort(diag(cdd));ii = flipud(ii);evects = cvv(:,ii);cdd = diag(cdd);evals = cdd(ii);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?