annotate DL/Majorization Minimization DL/ExactDicoRecovery/mapdl_cn.m @ 243:1fbd28dfb99e unlocbox

setup file
author bmailhe
date Wed, 29 Aug 2012 10:39:14 +0100
parents b14209313ba4
children
rev   line source
ivan@155 1 % Maximum A Posteriori Estimation 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] = mapdl_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 % [PhiM,L] = size(ud);
ivan@155 13 [PhiN,L] = size(Y);
ivan@155 14 X = ones(PhiM,L);
ivan@155 15 for it = 1:IT
ivan@155 16 to = .1+svds(Phi,1);
ivan@155 17 [PhiN,PhiM] = size(Phi);
ivan@155 18 %%%%
ivan@155 19 eps = 3*10^-4;
ivan@155 20 map = 1; % Projecting on the selected space (0=no,1=yes)
ivan@155 21 [X,l1err] = mm1(Phi,Y,X,to,lambda,maxIT,eps,map); %% Sparse approximation with Iterative Soft-thresholding
ivan@155 22 ert(it) = l1err;
ivan@155 23 %%%
ivan@155 24 eps = 10^-7;
ivan@155 25 mu = 10^-4;
ivan@155 26 [Phi,X] = dict_update_MAP_cn(Phi,Y,X,mu,maxIT,eps,res);
ivan@155 27 end
ivan@155 28 Phiout = Phi;