📄 classs.m
字号:
%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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -