reducm.m

来自「模式识别工具箱,本人毕业论文时用到的,希望对大家有用!」· M 代码 · 共 40 行

M
40
字号
%REDUCM Reduce to minimal space%%	W = reducm(A)%% Ortho-normal mapping to a space in which the dataset A exactly fits.% This is useful for datasets with more features than objects.% For the objects in B = A*W holds that their dimensionality is% minimum, their mean is zero, the covariance matrix is diagonal with % decreasing variances and the interobject distances are equal to% those of A.%% See also datasets, mappings, nlfisherm, klm% Copyright: R.P.W. Duin, duin@ph.tn.tudelft.nl% Faculty of Applied Physics, Delft University of Technology% P.O. Box 5046, 2600 GA Delft, The Netherlandsfunction W = reducm(a)if nargin < 1 | isempty(a)   W = mapping('reducm'); returnendif isa(a,'dataset')	imheight = getimheight(a);	a = +a;else	imheight = 0;end[m,k] = size(a);[R,s,v] = svd(a',0);a = a*R;r = rank(a);if r == m, r = r-1; enda = a/max(abs(a(:))); % occasionally necessary to prevent inf's in covG = cov(a);[F V] = eig(G); [v,I] = sort(-diag(V)); I = I(1:r);R = R*F(:,I);W = mapping('affine',[R;-mean(a*F(:,I))],[],k,r,1,imheight);

⌨️ 快捷键说明

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