annotate DL/Majorization Minimization DL/ExactDicoRecovery/mod_cn.m @ 198:83af80baf959 luisf_dev

Reverted SMALL_two_step to the original version; adds path in the Init script.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Tue, 20 Mar 2012 12:29:47 +0000
parents b14209313ba4
children
rev   line source
ivan@155 1 % MOD method 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] = mod_cn(Y,Phi,lambda,IT)
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 res = 2; % Fixed column norm dictionary constraint.
ivan@155 24 [Phi,X] = dict_update_MOD_cn(Y,X,res);
ivan@155 25 end
ivan@155 26 Phiout = Phi;