changeset 176:d0645d5fca7d danieleb

added MOCOD dictionary update
author Daniele Barchiesi <daniele.barchiesi@eecs.qmul.ac.uk>
date Thu, 17 Nov 2011 11:17:44 +0000
parents 9eb5f0d4c1a4
children 714fa7b8c1ad
files DL/two-step DL/SMALL_two_step_DL.m
diffstat 1 files changed, 17 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/DL/two-step DL/SMALL_two_step_DL.m	Thu Nov 17 11:17:00 2011 +0000
+++ b/DL/two-step DL/SMALL_two_step_DL.m	Thu Nov 17 11:17:44 2011 +0000
@@ -4,7 +4,7 @@
 
 solver = DL.param.solver;
 
-% determine which type of udate to use ('KSVD', 'MOD', 'ols' or 'mailhe') %
+% determine which type of udate to use ('KSVD', 'MOD','MOCOD','ols' or 'mailhe') %
 
 typeUpdate = DL.name;
 
@@ -83,6 +83,8 @@
     decorrelate = 0;
 end
 
+if ~isfield(DL.param,'decFcn'), DL.param.decFcn = 'none'; end
+
 % show dictonary every specified number of iterations
 
 if isfield(DL.param,'show_dict')
@@ -109,11 +111,21 @@
 
 for i = 1:iternum
     %disp([num2str(i) '/' num2str(iternum)]);
-    Problem.A = dico;
+    %SPARSE CODING STEP
+	Problem.A = dico;
     solver = SMALL_solve(Problem, solver);
-    [dico, solver.solution] = dico_update(dico, sig, solver.solution, ...
-        typeUpdate, flow, learningRate);
-    dico = normcols(dico);
+	%DICTIONARY UPDATE STEP
+	if strcmpi(typeUpdate,'mocod')			%if update is MOCOD create parameters structure
+		mocodParams = struct('zeta',DL.param.zeta,...	%coherence regularization factor
+							 'eta',DL.param.eta,...		%atoms norm regularization factor
+							 'Dprev',dico);				%previous dictionary
+		dico = dico_update(dico,sig,solver.solution,typeUpdate,flow,learningRate,mocodParams);
+	else
+		[dico, solver.solution] = dico_update(dico, sig, solver.solution, ...
+			typeUpdate, flow, learningRate);
+		dico = normcols(dico);
+	end
+    
         switch lower(DL.param.decFcn)
             case 'ink-svd'
                 dico = dico_decorr_symetric(dico,mu,solver.solution);