Commit 6b8fa1ac authored by actb's avatar actb
Browse files

added Regularize to Distance.SpectralCluster

parent a4096457
......@@ -20,6 +20,29 @@ end
idx=kmeans(Y,k,'emptyaction','singleton','replicates',NREP);
end
function [D,degenerate] = Regularize(DistanceMatrix)
% turn output from NCD into well behaved distance matrix
D=DistanceMatrix;
% b = max(max(D));
% D=D/b;
for i=1:size (D,1)
for j= 1:size(D,2)
D(i,j)= max(D(i,j),D(j,i));
end
D(i,i)=0;
end
bound=D;
for i=1: size(bound,1)
bound(i,i)=NaN;
end
a = min(min(bound));
if 0==a
degenerate=1;
else
degenerate=0;
end
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment