comparison DL/two-step DL/SMALL_two_step_DL.m @ 156:a4d0977d4595 danieleb

First branch commit, danieleb
author danieleb
date Tue, 30 Aug 2011 11:12:31 +0100
parents af307f247ac7
children 88578ec2f94a
comparison
equal deleted inserted replaced
153:af307f247ac7 156:a4d0977d4595
74 else 74 else
75 iternum = 40; 75 iternum = 40;
76 end 76 end
77 % determine if we should do decorrelation in every iteration % 77 % determine if we should do decorrelation in every iteration %
78 78
79 if isfield(DL.param,'coherence') 79 if isfield(DL.param,'coherence') && isscalar(DL.param.coherence)
80 decorrelate = 1; 80 decorrelate = 1;
81 mu = DL.param.coherence; 81 mu = DL.param.coherence;
82 else 82 else
83 decorrelate = 0; 83 decorrelate = 0;
84 end 84 end
106 solver.profile = 0; 106 solver.profile = 0;
107 107
108 % main loop % 108 % main loop %
109 109
110 for i = 1:iternum 110 for i = 1:iternum
111 disp([num2str(i) '/' num2str(iternum)]);
111 Problem.A = dico; 112 Problem.A = dico;
112 solver = SMALL_solve(Problem, solver); 113 solver = SMALL_solve(Problem, solver);
113 [dico, solver.solution] = dico_update(dico, sig, solver.solution, ... 114 [dico, solver.solution] = dico_update(dico, sig, solver.solution, ...
114 typeUpdate, flow, learningRate); 115 typeUpdate, flow, learningRate);
115 if (decorrelate) 116 dico = normcols(dico);
116 dico = dico_decorr(dico, mu, solver.solution); 117 switch DL.param.decFcn
117 end 118 case 'mailhe'
119 dico = dico_decorr(dico, mu, solver.solution);
120 case 'tropp'
121 [n m] = size(dico);
122 dico = grassmanian(n,m,[],[],[],dico,true);
123 otherwise
124 end
118 125
119 if ((show_dictionary)&&(mod(i,show_iter)==0)) 126 if ((show_dictionary)&&(mod(i,show_iter)==0))
120 dictimg = SMALL_showdict(dico,[8 8],... 127 dictimg = SMALL_showdict(dico,[8 8],...
121 round(sqrt(size(dico,2))),round(sqrt(size(dico,2))),'lines','highcontrast'); 128 round(sqrt(size(dico,2))),round(sqrt(size(dico,2))),'lines','highcontrast');
122 figure(2); imagesc(dictimg);colormap(gray);axis off; axis image; 129 figure(2); imagesc(dictimg);colormap(gray);axis off; axis image;