mediandistance.m

来自「clustering_code ,Clustering Through Rank」· M 代码 · 共 47 行

M
47
字号
function W=medianDistance(dst,K)%% Clustering Through Ranking On Manifolds% Version 0.2%% Copyright by Markus Breitenbach and Gregory Z. Grudic% This code is for your personal and research use only.%% http://www.cs.colorado.edu/~grudic/% http://ucsu.colorado.edu/~breitenm/%% This software is provided "as is," without warranty of any kind, express% or implied.  In no event shall the authors be held liable% for any direct, indirect, incidental, special or consequential damages% arising out of the use of or inability to use this software.%if nargin<2        K=5; % 5 nearest neighborsend;[N D] = size(dst);% takes a distance matrix, determines \sigma_i and \sigma_j per point and% outputs W%X2 = sum(X.^2,1);%distance = repmat(X2,N,1)+repmat(X2',1,N)-2*X'*X;[sorted,index] = sort(dst);neighborhood = index(2:(1+K),:);% determine all sigma's per pointfor i=1:N    sigma(i) = median( dst(i,neighborhood(:,i)) );end;W = zeros(N);for i=1:N    for j=1:N        W(i,j)= -dst(i,j)/(sigma(i)*sigma(j));    end;end;W = exp(W);

⌨️ 快捷键说明

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