main_emnenmf_vs_remnenmf.m 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. clear all
  2. %% Adding every files in the path
  3. addpath(genpath(pwd))
  4. %% Simulation parameters
  5. s_width = 20; % Scene width
  6. s_length = 20; % Scene length
  7. N_Ref = 4; % Nb. of reference measurements
  8. N_Cpt = 100; % Nb. of mobile sensors
  9. Mu_beta = .9; % Mean sensors gain
  10. Mu_alpha = 5; % Mean sensors offset
  11. Bound_beta = [.01;1.5]; % Gain boundaries
  12. Bound_alpha = [3.5;6.5]; % Offset boundaries
  13. MV = .5; % Missing Value prop.
  14. RV = 0.3; % RendezVous prop.
  15. var_n = 0; % Noise variance
  16. M_loop = 50; % Number of M loop per E step
  17. runs = 1; % Total number of runs
  18. %% Nesterov parameters
  19. InnerMinIter = 5;
  20. InnerMaxIter = 20;
  21. Tmax = 60;
  22. %% Compression parameters
  23. nu = 10;
  24. %%
  25. delta_measure = 1;
  26. iter_max = round(Tmax / delta_measure);
  27. %% Allocation for the RMSE values
  28. % remnenmf
  29. RMSE_offset_remnenmf = nan(runs, iter_max);
  30. RMSE_gain_remnenmf = nan(runs, iter_max);
  31. % emnenmf
  32. RMSE_offset_emnenmf = nan(runs, iter_max);
  33. RMSE_gain_emnenmf = nan(runs, iter_max);
  34. for run = 1:runs
  35. % data generation
  36. [X, X_theo, W, F_theo, Omega_G, Omega_F, Phi_G, Phi_F, Ginit, Finit] = data_gen(s_width, s_length, run, N_Ref, N_Cpt, Mu_beta, Mu_alpha, Bound_beta, Bound_alpha, MV, RV, var_n);
  37. seed = floor(rand*10000);
  38. % remnenmf
  39. rng(seed)
  40. [T_remnenmf, RMSE] = remnenmf_not_full( W , X , Ginit , Finit, Omega_G, Omega_F, Phi_G, Phi_F , InnerMinIter , InnerMaxIter , Tmax , M_loop, F_theo, delta_measure, nu);
  41. RMSE_offset_remnenmf(run,:) = RMSE(1,:);
  42. RMSE_gain_remnenmf(run,:) = RMSE(2,:);
  43. % emnenmf
  44. rng(seed)
  45. [T_emnenmf, RMSE] = emnenmf( W , X , Ginit , Finit, Omega_G, Omega_F, Phi_G, Phi_F , InnerMinIter , InnerMaxIter , Tmax , M_loop, F_theo, delta_measure);
  46. RMSE_offset_emnenmf(run,:) = RMSE(1,:);
  47. RMSE_gain_emnenmf(run,:) = RMSE(2,:);
  48. end
  49. % remnenmf
  50. min_offset_remnenmf = min(RMSE_offset_remnenmf,[],1,'omitnan');
  51. med_offset_remnenmf = median(RMSE_offset_remnenmf,1,'omitnan');
  52. max_offset_remnenmf = max(RMSE_offset_remnenmf,[],1,'omitnan');
  53. min_gain_remnenmf = min(RMSE_gain_remnenmf,[],1,'omitnan');
  54. med_gain_remnenmf = median(RMSE_gain_remnenmf,1,'omitnan');
  55. max_gain_remnenmf = max(RMSE_gain_remnenmf,[],1,'omitnan');
  56. figure
  57. subplot(121)
  58. semilogy(T_remnenmf,min_offset_remnenmf,'b')
  59. hold on
  60. semilogy(T_remnenmf,med_offset_remnenmf,'b')
  61. o_e = semilogy(T_remnenmf,max_offset_remnenmf,'b');
  62. hold off
  63. subplot(122)
  64. semilogy(T_remnenmf,min_gain_remnenmf,'b')
  65. hold on
  66. semilogy(T_remnenmf,med_gain_remnenmf,'b')
  67. g_e = semilogy(T_remnenmf,max_gain_remnenmf,'b');
  68. hold off
  69. % emnenmf
  70. min_offset_emnenmf = min(RMSE_offset_emnenmf,[],1,'omitnan');
  71. med_offset_emnenmf = median(RMSE_offset_emnenmf,1,'omitnan');
  72. max_offset_emnenmf = max(RMSE_offset_emnenmf,[],1,'omitnan');
  73. min_gain_emnenmf = min(RMSE_gain_emnenmf,[],1,'omitnan');
  74. med_gain_emnenmf = median(RMSE_gain_emnenmf,1,'omitnan');
  75. max_gain_emnenmf = max(RMSE_gain_emnenmf,[],1,'omitnan');
  76. subplot(121)
  77. hold on
  78. semilogy(T_emnenmf,min_offset_emnenmf,'r')
  79. semilogy(T_emnenmf,med_offset_emnenmf,'r')
  80. o_i = semilogy(T_emnenmf,max_offset_emnenmf,'r');
  81. hold off
  82. subplot(122)
  83. hold on
  84. semilogy(T_emnenmf,min_gain_emnenmf,'r')
  85. semilogy(T_emnenmf,med_gain_emnenmf,'r')
  86. g_i = semilogy(T_emnenmf,max_gain_emnenmf,'r');
  87. hold off
  88. % adding title and labels
  89. subplot(121)
  90. title('RMSE offset')
  91. legend([o_e o_i],'REMNeNMF','EMNeNMF')
  92. subplot(122)
  93. title('RMSE gain')
  94. legend([g_e g_i],'REMNeNMF','EMNeNMF')