comparison DL/Majorization Minimization DL/dict_update_REG_fn.m @ 155:b14209313ba4 ivand_dev

Integration of Majorization Minimisation Dictionary Learning
author Ivan Damnjanovic lnx <ivan.damnjanovic@eecs.qmul.ac.uk>
date Mon, 22 Aug 2011 11:46:35 +0100
parents
children
comparison
equal deleted inserted replaced
154:0de08f68256b 155:b14209313ba4
1 function [Phiout,unhatnz] = dict_update_REG_fn(Phi,x,unhat,maxIT,eps,cvset)
2 %% Regularized Dictionary Learning with the constraint on the matrix frobenius norms %%%%%
3 % Phi = Normalized Initial Dictionary
4 % x = Signal(x). This can be a vector or a matrix
5 % unhat = Initial guess for the coefficients
6 % to = 1/(step size) . It is larger than spectral norm of coefficient matrix x
7 % eps = Stopping criterion for iterative softthresholding and MM dictionary update
8 % cvset = Dictionary constraint. 0 = Non convex ||D|| = N, 1 = Convex ||D||<=N
9 % Phiout = Updated Dictionary
10 % unhatnz Updated Coefficients (the same as input in this version)
11
12 %%
13 B = Phi;
14 phim = norm(Phi, 'fro');
15 K = zeros(size(Phi,1),size(Phi,2));
16 c = .1 + svds(unhat,1)^2;
17
18 %%
19 i = 1;
20 while (sum(sum((B-K).^2)) > eps)&&(i<=maxIT)
21 if i>1
22 B = K;
23 end
24 K = 1/c *(x*unhat' + B*(c*eye(size(B,2))-unhat*unhat'));
25 Kfn = sum(sum(K.^2));
26 if cvset == 1,
27 K = min(1,phim/Kfn)*K; % with convex constraint set
28 else
29 K = (phim/Kfn)*K; % with fixed-norm constraint set
30 end
31 i = i+1;
32 end
33
34 %% depleted atoms cancellation %%%
35 [Y,I] = sort(sum(K.^2),'descend');
36 RR = sum(Y>=0.0001);
37 Phiout = K(:,I(1:RR));
38 unhatnz = unhat(I(1:RR),:);
39 end