10 likes | 191 Views
% compute K(q) L=unique(label); for i =1:4 TAB( i )=length(find(label==L( i ))); end K(q)=min(4*NG(q), 2* max(TAB)); % CMPUTE NR(q) Idx =index(q,1:K(q)); LabelIdx =label( Idx ); NR(q)=length(find( LabelIdx ==la)); %compute MR(q) MR(q)=NG(q)-NR(q); % compute rank
E N D
% compute K(q) L=unique(label); for i=1:4 TAB(i)=length(find(label==L(i))); end K(q)=min(4*NG(q), 2* max(TAB)); % CMPUTE NR(q) Idx=index(q,1:K(q)); LabelIdx=label(Idx); NR(q)=length(find(LabelIdx==la)); %compute MR(q) MR(q)=NG(q)-NR(q); % compute rank Rank(index(q,:))=1:length(label); I=find(label==la); I2=find(Rank(I)>K(q)); Rank(I(I2))=1.25*K(q); % compute AVR(q) AVR(q)= sum (Rank(I))/NG(q); MRR(q)= AVR(q)-0.5*(1+NG(q)); y=MRR(q)/(1.25*K(q)-0.5-0.5*NG(q)); function [y]=NMRR(q,feat) %feat: 1:ehd feature % 2:color feature % 3:shape feature switch feat case 1 load indexehdDist.mat; index=indexehdDist; case 2 load indexcolorDist.mat; index=indexcolorDist; case 3 load indexshapeDist.mat; index=indexshapeDist; end load names.mat load label.mat % compute NG(q) la=label(q); NG(q)=length(find(label==la));