classs.m
来自「matlab 模式识别工具包 希望能对你们有用」· M 代码 · 共 41 行
M
41 行
%CLASSS Linear mapping by classical scaling% % W = classs(D,k)% % Calculates a linear mapping W of a distance matrix D to k dimensions.% D should be square, size m x m. New objects may be mapped by% E*W in which E is a n x m distance matrix to the original set of% m objects. Default k = 2.% % See also: mappings, datasets, mds% 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 =classs (D,n)if nargin < 2, n = 2; endif nargin < 1 | isempty(D) W = mapping('classs',n); returnend[nlab,lablist,m,k,c,prob] = dataset(D);if m~=k, error('Distance matrix should be square'); endJ = eye(m) - ones (m,m) ./m;B = - 0.5 .* J * ((+D).^2) * J;[V,S,U] = svds (B, n);V = V .* repmat(sign(V(1,:)),m,1); % takes care of reproducabilityA = V * sqrt(S);if rank(+D) < m, W = pinv(D)*A;else W = D \ A;endW = mapping('mds',W,[],m,n,1);return
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?