njit-etd2003-081 - New Jersey Institute of Technology

njit-etd2003-081 - New Jersey Institute of Technology njit-etd2003-081 - New Jersey Institute of Technology

archives.njit.edu
from archives.njit.edu More from this publisher
20.01.2015 Views

299 case {'hier_single'} cluster= dcAgg(distance, 'single', k); for j = 1:k Estlndex(i,cluster{j })=j ; end case {'hier_centroid'} cluster = dcAgg(distance, 'centroid', k); for j = 1:k EstIndex(i,cluster{j }) j; end case 'fuzzy' m=1.5; Estlndex(i,:) = dcFuzzy(Data,k,m,InitCentres); case 'random' Estlndex(i,:) = floor(rand( 1 ,R)*k+ 1 ); %randomly assign labels %otherwise error(sprintf('DOCLUSTERING - unsupported algorithm "%s'",Algorithm)) end %of switch/case %return adjusted Rand index (accuracy) if true labels are given if length(TrueID)>0 RITrue(i)=RandIndex(EstIndex(i,:), TruelD); else RITrue(i)=-1; end end %of repetitions loop %Calculate adjusted Rand index between each pair of solutions found if Repetitions > 1 l=0; for i=1 :Repetitions-1 for j=i+ 1 :Repetitions l=l+1; RISelf(l)=RandIndex(EstIndex(i,:)',EstIndex(j,:)'); end end else RISelf=0; end

300 B.2.8 Cross-correlation Program The program below calculates the correlation indices for selecting the best timefrequency representation. function xy = corrcoef(x,y) %CORRCOEF Correlation coefficients. % CORRCOEF(X) is a matrix of correlation coefficients formed % from array X whose each row is an observation, and each % column is a variable. % CORRCOEF(X,Y), where X and Y are column vectors is the same as % CORRCOEF([X YD. % If C is the covariance matrix, C = COV(X), then CORRCOEF(X) is % the matrix whose (i,j)'th element is C(i,j)/SQRT(C(i,i)*C(j,j)). % See also COV, STD. % J. Little 5-5-86 % Revised 6-9-88 LS 2-13-95 BJ % Copyright 1984-2001 The MathWorks, Inc. % $Revision: 5.8 $ $Date: 2001/04/15 12:01:28 $ switch nargin case 1 c = cov(x); case 2 c = cov(x,y); otherwise error('Not enough input arguments.'); end d = diag(c); xy = c./sqrt(d*d');

299<br />

case {'hier_single'}<br />

cluster= dcAgg(distance, 'single', k);<br />

for j = 1:k<br />

Estlndex(i,cluster{j })=j ;<br />

end<br />

case {'hier_centroid'}<br />

cluster = dcAgg(distance, 'centroid', k);<br />

for j = 1:k<br />

EstIndex(i,cluster{j }) j;<br />

end<br />

case 'fuzzy'<br />

m=1.5;<br />

Estlndex(i,:) = dcFuzzy(Data,k,m,InitCentres);<br />

case 'random'<br />

Estlndex(i,:) = floor(rand( 1 ,R)*k+ 1 ); %randomly assign labels<br />

%otherwise<br />

error(sprintf('DOCLUSTERING - unsupported algorithm "%s'",Algorithm))<br />

end %<strong>of</strong> switch/case<br />

%return adjusted Rand index (accuracy) if true labels are given<br />

if length(TrueID)>0<br />

RITrue(i)=RandIndex(EstIndex(i,:), TruelD);<br />

else<br />

RITrue(i)=-1;<br />

end<br />

end %<strong>of</strong> repetitions loop<br />

%Calculate adjusted Rand index between each pair <strong>of</strong> solutions found<br />

if Repetitions > 1<br />

l=0;<br />

for i=1 :Repetitions-1<br />

for j=i+ 1 :Repetitions<br />

l=l+1;<br />

RISelf(l)=RandIndex(EstIndex(i,:)',EstIndex(j,:)');<br />

end<br />

end<br />

else<br />

RISelf=0;<br />

end

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!