comparison DL/two-step DL/SMALL_two_step_DL.m @ 209:dfa795944aae luisf_dev

fixed some bugs in the default parameters of SMALL_two_step_DL
author bmailhe
date Wed, 21 Mar 2012 16:21:18 +0000
parents 83af80baf959
children f12a476a4977
comparison
equal deleted inserted replaced
208:36b02a8d0add 209:dfa795944aae
2 2
3 % determine which solver is used for sparse representation % 3 % determine which solver is used for sparse representation %
4 4
5 solver = DL.param.solver; 5 solver = DL.param.solver;
6 6
7 % determine which type of udate to use ('KSVD', 'MOD', 'ols' or 'mailhe') % 7 % determine which type of udate to use ('KSVD', 'MOD', 'ols', 'opt' or 'LGD') %
8 8
9 typeUpdate = DL.name; 9 typeUpdate = DL.name;
10 10
11 sig = Problem.b; 11 sig = Problem.b;
12 12
56 flow = 'sequential'; 56 flow = 'sequential';
57 end 57 end
58 58
59 % learningRate. If the type is 'ols', it is the descent step of 59 % learningRate. If the type is 'ols', it is the descent step of
60 % the gradient (typical choice: 0.1). If the type is 'mailhe', the 60 % the gradient (typical choice: 0.1). If the type is 'mailhe', the
61 % descent step is the optimal step*rho (typical choice: 1, although 2 61 % descent step is the optimal step*rho (typical choice: 1, although 2 works
62 % or 3 seems to work better). Not used for MOD and KSVD. 62 % better). Not used for MOD and KSVD.
63 63
64 if isfield(DL.param,'learningRate') 64 if isfield(DL.param,'learningRate')
65 learningRate = DL.param.learningRate; 65 learningRate = DL.param.learningRate;
66 else 66 else
67 learningRate = 0.1; 67 switch typeUpdate
68 case 'ols'
69 learningRate = 0.1;
70 otherwise
71 learningRate = 1;
72 end
68 end 73 end
69 74
70 % number of iterations (default is 40) % 75 % number of iterations (default is 40) %
71 76
72 if isfield(DL.param,'iternum') 77 if isfield(DL.param,'iternum')
111 Problem.A = dico; 116 Problem.A = dico;
112 solver = SMALL_solve(Problem, solver); 117 solver = SMALL_solve(Problem, solver);
113 [dico, solver.solution] = dico_update(dico, sig, solver.solution, ... 118 [dico, solver.solution] = dico_update(dico, sig, solver.solution, ...
114 typeUpdate, flow, learningRate); 119 typeUpdate, flow, learningRate);
115 if (decorrelate) 120 if (decorrelate)
116 dico = dico_decorr(dico, mu, solver.solution); 121 dico = dico_decorr_symetric(dico, mu, solver.solution);
117 end 122 end
118 123
119 if ((show_dictionary)&&(mod(i,show_iter)==0)) 124 if ((show_dictionary)&&(mod(i,show_iter)==0))
120 dictimg = SMALL_showdict(dico,[8 8],... 125 dictimg = SMALL_showdict(dico,[8 8],...
121 round(sqrt(size(dico,2))),round(sqrt(size(dico,2))),'lines','highcontrast'); 126 round(sqrt(size(dico,2))),round(sqrt(size(dico,2))),'lines','highcontrast');