annotate DL/Majorization Minimization DL/wrapper_mm_solver.m @ 160:e3035d45d014 danieleb

Added support classes
author Daniele Barchiesi <daniele.barchiesi@eecs.qmul.ac.uk>
date Wed, 31 Aug 2011 10:53:10 +0100
parents b14209313ba4
children f42aa8bcb82f
rev   line source
ivan@155 1 function [X , cost] = wrapper_mm_solver(b, A, param)
ivan@155 2 %% SMALL wrapper for Majorization Maximization toolbos solver
ivan@155 3 %
ivan@155 4 % Function gets as input
ivan@155 5 % b - measurement vector
ivan@155 6 % A - dictionary
ivan@155 7 % param - structure containing additional parameters
ivan@155 8 % Output:
ivan@155 9 % x - sparse solution
ivan@155 10 % cost - Objective cost
ivan@155 11
ivan@155 12 % Centre for Digital Music, Queen Mary, University of London.
ivan@155 13 % This file copyright 2011 Ivan Damnjanovic.
ivan@155 14 %
ivan@155 15 % This program is free software; you can redistribute it and/or
ivan@155 16 % modify it under the terms of the GNU General Public License as
ivan@155 17 % published by the Free Software Foundation; either version 2 of the
ivan@155 18 % License, or (at your option) any later version. See the file
ivan@155 19 % COPYING included with this distribution for more information.
ivan@155 20 %
ivan@155 21 %%
ivan@155 22
ivan@155 23 % Initial guess for the coefficients
ivan@155 24
ivan@155 25 if (isfield(param, 'initcoeff'))
ivan@155 26 initX = param.initcoeff;
ivan@155 27 else
ivan@155 28 initX = zeros(size(A,2),size(b,2));
ivan@155 29 end
ivan@155 30
ivan@155 31 % to - 1/(step size) . It is larger than spectral norm of dictionary A
ivan@155 32
ivan@155 33 if isfield(param, 'to')
ivan@155 34 to = param.to;
ivan@155 35 else
ivan@155 36 to = .1+svds(A,1);
ivan@155 37 end
ivan@155 38
ivan@155 39 % lambda - Lagrangian multiplier. (regulates shrinkage)
ivan@155 40
ivan@155 41 if isfield(param, 'lambda')
ivan@155 42 lambda = param.lambda;
ivan@155 43 else
ivan@155 44 lambda = 2*.2;
ivan@155 45 end
ivan@155 46
ivan@155 47 % Inner-loop maximum iteration number.
ivan@155 48
ivan@155 49 if isfield(param, 'iternum')
ivan@155 50 maxIT = param.iternum;
ivan@155 51 else
ivan@155 52 maxIT = 1000;
ivan@155 53 end
ivan@155 54
ivan@155 55 % Stopping criterion for iterative softthresholding
ivan@155 56
ivan@155 57 if isfield(param, 'epsilon')
ivan@155 58 epsilon = param.epsilon;
ivan@155 59 else
ivan@155 60 epsilon = 1e-7;
ivan@155 61 end
ivan@155 62
ivan@155 63 % Debiasing. 0 = No, 1 = Yes
ivan@155 64
ivan@155 65 if isfield(param, 'map')
ivan@155 66 map = param.map;
ivan@155 67 else
ivan@155 68 map = 1;
ivan@155 69 end
ivan@155 70
ivan@155 71
ivan@155 72 [X, cost] = mm1(A,b,initX,to,lambda,maxIT,epsilon,map);
ivan@155 73 cost
ivan@155 74 end