Skip to content
Snippets Groups Projects
Commit 6b8fa1ac authored by actb's avatar actb
Browse files

added Regularize to Distance.SpectralCluster

parent a4096457
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,29 @@ end
idx=kmeans(Y,k,'emptyaction','singleton','replicates',NREP);
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment