Demo.m 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. % Author : F. Yahaya
  2. % Date: 06/09/2018
  3. % Contact: farouk.yahaya@univ-littoral.fr
  4. % clear all variables
  5. % First, initialize the random number generator to make the results in each
  6. % test repeatable.
  7. % using a seed of 1 rng(1)
  8. % Goal: Execute the algorithms viz., Vanila NeNMF, Randomized Power
  9. % Iterations NeNMF (RPI), Randomized Subspace Iterations NeNMF (RSI) for
  10. % sizes: [m,n]=500, 5000,10000.
  11. % Tmax : Execution time in seconds.
  12. % mat_size : Give a name to your matrix size for easier identification of output
  13. % Total_Tests : Total number of test to perform. E.g. we made 40 tests.
  14. clear
  15. clc
  16. Tmax =15;
  17. Total_Tests=40;
  18. for i=1:Total_Tests
  19. mat_size='500x500'; % this is just for naming. To change matrix size, open the "data_simulation.m" file and change
  20. % your mxn matrix size as desired.
  21. % % Randomized Subspace Iterations (NeNMF)
  22. clearvars -except i Tmax mat_size Total_Tests;
  23. load( ['synthetic_data/data_',mat_size,'_',int2str(i),'.mat'])
  24. [ W_RSI_NeNMF , H_RSI_NeNMF,RRE_RSI_NeNMF, T_RSI_NeNMF] = RSI_NeNMF(X, Winit , Hinit ,r, Tmax);
  25. save( ['output/RSI_NeNMF_',mat_size,'_',int2str(i),'.mat'], 'RRE_RSI_NeNMF', 'T_RSI_NeNMF', '-v7.3' )
  26. % VANILA NeNMF
  27. clearvars -except i Tmax mat_size Total_Tests;
  28. load( ['synthetic_data/data_',mat_size,'_',int2str(i),'.mat'])
  29. [ W_VANILLA , H_VANILLA,RRE_VANILLA_NeNMF, T_VANILLA_NeNMF ] = VANILLA_NeNMF(X , Winit , Hinit,Tmax );
  30. save( ['output/vanilla_NeNMF_',mat_size,'_',int2str(i),'.mat'], 'RRE_VANILLA_NeNMF', 'T_VANILLA_NeNMF', '-v7.3' )
  31. disp( ['iter:',int2str(i), ' of ', mat_size , ' OK!'] )
  32. end
  33. disp(['matrix size ', '( ',mat_size,' )', ' : all ',int2str(Total_Tests), ' Tests', ' completed!' ]);