# HG changeset patch # User Daniele Barchiesi # Date 1321528664 0 # Node ID d0645d5fca7d451b52951ca15928a89a716aa051 # Parent 9eb5f0d4c1a472e87bd730777e4d5981ed3f4041 added MOCOD dictionary update diff -r 9eb5f0d4c1a4 -r d0645d5fca7d DL/two-step DL/SMALL_two_step_DL.m --- 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);