RecallTest.m 922 B

123456789101112131415161718192021222324252627282930313233
  1. function [NNeighPerf] = RecallTest(iXMinDistADC,nRecall,iMinDistExh)
  2. addpath('../Product Quantization/Functions');
  3. addpath('../Product Quantization/Functions/Yael Library');
  4. Ntests=size(iXMinDistADC,1);
  5. recAtR=([1 2 5 10 20 50 100 200 500 1000 2000 5000 10000]<=nRecall);
  6. reqRecall=zeros(Ntests,1);
  7. for ii = 1:Ntests
  8. iXeq=find(iXMinDistADC(ii,:)==iMinDistExh(1,ii));
  9. if numel(iXeq)==1
  10. reqRecall(ii)=iXeq;
  11. else
  12. reqRecall(ii)=nRecall+1;
  13. end
  14. end
  15. reqRecall=sort(reqRecall);
  16. ll=1;
  17. recAtR=[1 2 5 10 20 50 100 200 500 1000 2000 5000 10000];
  18. recAtR=recAtR(recAtR<=nRecall);
  19. NNeighPerf=zeros(1,length(recAtR));
  20. for ii=recAtR
  21. if ii <= nRecall
  22. NNeighPerf(ll) = length (find (reqRecall <= ii & reqRecall <= nRecall)) / Ntests;
  23. ll=ll+1;
  24. end
  25. end