IN_Cal.m 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. function [ G , F , R ] = IN_Cal( W , X , G , F , Omega_G , Omega_F , Phi_G , Phi_F , F_theo , N_iter )
  2. % Author: Clément DORFFER
  3. % Date: 26/11/2018
  4. % @: clement.dorffer@ensta-bretagne.fr
  5. % Goal: perform mobile sensor calibration using an Informed NMF calibraton technique.
  6. % If you use this code for research or educational purpose, please cite:
  7. %
  8. % C. Dorffer, M. Puigt, G. Delmaire, G. Roussel, Informed Nonnegative Matrix Factorization Methods for
  9. % Mobile Sensor Network Calibration, IEEE Transactions on Signal and Information Processing over Networks,
  10. % Volume 4, Issue 4, pp. 667-682, December 2018.
  11. %
  12. W2 = W.^2;
  13. Omega_Bar_G = ones(size(G))-Omega_G;
  14. Omega_Bar_F = ones(size(F))-Omega_F;
  15. Delta_G = G.*Omega_Bar_G;
  16. Delta_F = F.*Omega_Bar_F;
  17. R = zeros(N_iter+1,1);
  18. R(1) = norm(F(2,1:end-1)-F_theo(2,1:end-1),2)/sqrt(size(F_theo,2)-1);
  19. for i = 1 : N_iter
  20. % updating G
  21. Delta_G = Updt_Delta_G( W2 , X , Delta_G , Phi_G , F , Omega_Bar_G );
  22. G = Phi_G + Delta_G;
  23. % updating F
  24. Delta_F = Updt_Delta_F( W2 , X , G , Delta_F , Phi_F , Omega_Bar_F );
  25. F = Phi_F + Delta_F;
  26. R(i+1) = norm(F(2,1:end-1)-F_theo(2,1:end-1),2)/sqrt(size(F_theo,2)-1);
  27. end
  28. end
  29. function [ Delta_F ] = Updt_Delta_F( W , X , G , Delta_F , Phi_F , Omega_B_F )
  30. %%%%%%%%%%%%%%%%%%%%%%%%%%%
  31. % Update rule for Delta_F %
  32. %%%%%%%%%%%%%%%%%%%%%%%%%%%
  33. Delta_F = Delta_F.*(Omega_B_F).*((G'*(W.*secu_plus(X-G*Phi_F)))./(G'*(W.*(G*Delta_F))));
  34. Delta_F(isnan(Delta_F))=0;
  35. end
  36. function [ Delta_G ] = Updt_Delta_G( W , X , Delta_G , Phi_G , F , Omega_B_G )
  37. %%%%%%%%%%%%%%%%%%%%%%%%%%%
  38. % Update rule for Delta_G %
  39. %%%%%%%%%%%%%%%%%%%%%%%%%%%
  40. Delta_G = Delta_G.*(Omega_B_G).*((W.*secu_plus(X-Phi_G*F))*F')./((W.*(Delta_G*F)*F')); % mise à jour
  41. Delta_G(isnan(Delta_G))=0;
  42. end
  43. function [toto] = secu_plus(tutu,s)
  44. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  45. % Goal: Security in the NMF procedure which project the negative data to
  46. % epsilon (small user-defined threshold
  47. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  48. if(nargin<2)
  49. s=1.e-12;
  50. end
  51. toto=max(tutu,s);
  52. toto(isnan(tutu)) = 0;
  53. end