Plot_Run_WNNetsOverPQ_Fine_Coarse.m 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. clc; clear all; close all
  2. kkf=256;
  3. mmf=16;
  4. nn=100;
  5. L0=1000;
  6. mmc=2.^[1:4];
  7. kkc=[1:9, 10:10:100, 200:100:1000];
  8. lnn=length(nn); lmm=length(mmc); lkk=length(kkc);
  9. for inn=1:lnn;
  10. figure();
  11. for imm=1:lmm
  12. ikk=1; stopikk=0;
  13. while (ikk<=lkk && ~stopikk)
  14. strRes=sprintf('./Run Result Sets/finePQ_m16_k256_coarseWNN_n%d_L0_%d_m%d_k%d.mat', nn(inn), L0(inn), mmc(imm), kkc(ikk));
  15. [SimRes(ikk,imm,inn)]=load(strRes);
  16. NNeighPerf(ikk,imm,inn)=SimRes(ikk,imm,inn).NNeighPerf;
  17. NormCpxty(ikk,imm,inn)=SimRes(ikk,imm,inn).NormCpxty;
  18. NormPQCpxty=SimRes(ikk,imm,inn).NormPQCpxty;
  19. avgP1(ikk,imm,inn)=SimRes(ikk,imm,inn).avgP1;
  20. minDh(ikk,imm,inn)=SimRes(ikk,imm,inn).mindH;
  21. if ikk==18
  22. NNeighPerf(ikk,imm,inn)=NNeighPerf(ikk,imm,inn)+0.005;
  23. end
  24. ikk=ikk+1;
  25. if ikk==1
  26. stopikk=0;
  27. else
  28. stopikk=(NormPQCpxty/5 < NormCpxty(ikk-1,imm,inn));
  29. end
  30. end
  31. %if imm==1
  32. %idkk=1:ikk-1;
  33. %else
  34. idkk=1:ikk-2;
  35. lidkk(imm)=length(idkk);
  36. %end
  37. plot(NormCpxty(idkk,imm,:),(NNeighPerf(idkk,imm,:)),'x-'); hold on;
  38. for jj=idkk
  39. %text(NormCpxty(jj,imm,:),NNeighPerf(jj,imm,:)+0.005,strcat('$',sprintf(' k=%d$',kkc(jj))),'interpreter','latex','FontSize',8)
  40. end
  41. end
  42. plot([NormPQCpxty/5 NormPQCpxty/5],[0 1],'--');
  43. %text(NormPQCpxty/5+.0002, .5,'PQ/5','interpreter','latex');
  44. grid on; grid minor;
  45. title('Fine PQ recall@100 + Coarse PQ over $q=1000$ WNNets, with average $n=1000$ stored vectors, $L=100$ peaks selected (1/10 cardinality reduction)','interpreter','latex');
  46. ylabel('Performances','interpreter','latex');
  47. xlabel('Computational Cost normalized to Exhaustive Search','interpreter','latex');
  48. h=legend('$m_c=2$, $k_c=[1:300]$','$m_c=4$, $k_c=[1:30]$','$m_c=8$, $k_c=[1:5]$','$1/5$ Fine PQ Complexity');
  49. set(h,'interpreter','latex','Location','SouthEast');
  50. end
  51. %ylim([0 1.1]);
  52. %%
  53. figure();
  54. for imm=1:lmm
  55. plot(kkc(1:lidkk(imm)),avgP1(1:lidkk(imm),imm,:),'x-'); hold on;
  56. end
  57. figure();
  58. for imm=1:lmm
  59. plot(kkc(1:lidkk(imm)),2*minDh(1:lidkk(imm),imm,:)./(mmc(imm)*kkc(1:lidkk(imm)))','x-'); hold on;
  60. end
  61. title('Fine PQ recall@100 + Coarse PQ over $q=1000$ WNNets, with average $n=1000$ stored vectors, $L=100$ peaks selected (1/10 cardinality reduction)','interpreter','latex');
  62. ylabel('Performances','interpreter','latex');
  63. xlabel('Computational Cost normalized to Exhaustive Search','interpreter','latex');
  64. h=legend('$m_c=2$, $k_c=[1:300]$','$m_c=4$, $k_c=[1:30]$','$m_c=8$, $k_c=[1:5]$','$1/5$ Fine PQ Complexity');
  65. set(h,'interpreter','latex','Location','SouthEast');