annotate DL/Majorization Minimization DL/ExactDicoRecovery/mmdl_cn.m @ 247:ecce33192fcc
tip
Added tag ver_2.1 for changeset cef4500b936f
author |
luisf <luis.figueira@eecs.qmul.ac.uk> |
date |
Wed, 31 Oct 2012 12:24:44 +0000 |
parents |
b14209313ba4 |
children |
|
rev |
line source |
ivan@155
|
1 % Majorization Minimization for Dictionary Learning
|
ivan@155
|
2 % Y = input data (M X L matrix)
|
ivan@155
|
3 % Phi = initial dictionary (M X N), e.g. random dictionary or first N data samples
|
ivan@155
|
4 % lambda = regularization coefficient (||Phi*X-Y||_F)^2 + lambda*||X||_1
|
ivan@155
|
5 % IT = number of iterations
|
ivan@155
|
6 % res = dictionary constraint. 'un' = unit colomn norm, 'bn' = bounded colomn norm
|
ivan@155
|
7 function [Phiout,X,ert] = mmdl_cn(Y,Phi,lambda,IT,res)
|
ivan@155
|
8 maxIT = 1000;
|
ivan@155
|
9 [PhiN,PhiM] = size(Phi);
|
ivan@155
|
10 RR1 = PhiM;
|
ivan@155
|
11 %%%%%%%%%%%%%%
|
ivan@155
|
12 [PhiN,L] = size(Y);
|
ivan@155
|
13 X = ones(PhiM,L);
|
ivan@155
|
14 for it = 1:IT
|
ivan@155
|
15 to = .1+svds(Phi,1);
|
ivan@155
|
16 [PhiN,PhiM] = size(Phi);
|
ivan@155
|
17 %%%%
|
ivan@155
|
18 eps = 3*10^-4;
|
ivan@155
|
19 map = 1; % Projecting on the selected space (0=no,1=yes)
|
ivan@155
|
20 [X,l1err] = mm1(Phi,Y,X,to,lambda,maxIT,eps,map); %% Sparse approximation with Iterative Soft-thresholding
|
ivan@155
|
21 ert(it) = l1err;
|
ivan@155
|
22 %%%
|
ivan@155
|
23 eps = 10^-7;
|
ivan@155
|
24 [Phi,X] = dict_update_REG_cn(Phi,Y,X,maxIT,eps,res);
|
ivan@155
|
25 end
|
ivan@155
|
26 Phiout = Phi; |