# HG changeset patch # User Aris Gretsistas # Date 1332535705 0 # Node ID 4337e28183f1c813aee627c94bfcc92e73e6ae3d # Parent c38d965b5a1de66b3422dfc1424ed581a04bd317 Modified help comments of wrapper_mm_DL.m, wrapper_mm_solver.m, SMALL_rlsdla.m & SMALL_AudioDenoise_DL_test_KSVDvsSPAMS.m. Moved wrapper_ALPS_toolbox from toolboxes to toolboxes/alps and added some extra help comments. diff -r c38d965b5a1d -r 4337e28183f1 DL/Majorization Minimization DL/wrapper_mm_DL.m --- a/DL/Majorization Minimization DL/wrapper_mm_DL.m Thu Mar 22 15:37:45 2012 +0000 +++ b/DL/Majorization Minimization DL/wrapper_mm_DL.m Fri Mar 23 20:48:25 2012 +0000 @@ -3,30 +3,44 @@ % % Function gets as input Problem and Dictionary Learning (DL) structures % and outputs the learned Dictionary. - +% % In Problem structure field b with the training set needs to be defined. - +% % In DL structure field with name of the Dictionary update method needs % to be present. For the orignal version of MM algorithm the update % method should be: -% - 'mm_cn' - Regularized DL with column norm contraint -% - 'mm_fn' - Regularized DL with Frobenius norm contraint +% - 'mm_cn' Regularized DL with column norm contraint +% - 'mm_fn' Regularized DL with Frobenius norm contraint % Alternatively, for comparison purposes the following Dictioanry update % methods (which do not represent the optimised version of the algorithm) % be used: -% - 'mod_cn' - Method of Optimized Direction -% - 'map-cn' - Maximum a Posteriory Dictionary update -% - 'ksvd-cn'- KSVD update -% -% DL.param.solver structure is also required. For the original version of -% MM algorithm, DL.param.solver.toolbox should be 'MMbox'. The parameters -% in DL.param.solver.param should be set accordingly. Type help -% wrapper_mm_solver for more details. +% - 'mod_cn' Method of Optimized Direction +% - 'map-cn' Maximum a Posteriory Dictionary update +% - 'ksvd-cn' KSVD update +% +% The structure DL.param with parameters is also required. These are: +% - solver structure with fields toolbox, solver and parameters. +% For the original version of the algorithm toolbox +% should be 'MMbox' and solver field should be left +% empty ''. Type HELP WRAPPER_MM_SOLVER for more +% details on how to set the parameters. +% - initdict Initial Dictionary +% - dictsize Dictionary size (optional) +% - iternum Number of iterations (default is 40) +% - iterDictUpdate Number of iterations for Dictionary Update (default is 1000) +% - epsDictUpdate Stopping criterion for MM dictionary update (default = 1e-7) +% - cvset Dictionary constraint - 0 = Non convex ||d|| = 1, 1 = Convex ||d||<=1 +% (default is 0) +% - coherence Set at 1 if to perform decorrelation in every iteration +% (default is 0) +% - show_dict Show dictonary every specified number of iterations +% % % - MM-DL - Yaghoobi, M.; Blumensath, T,; Davies M.; , "Dictionary % Learning for Sparse Approximation with Majorization Method," IEEE % Transactions on Signal Processing, vol.57, no.6, pp.2178-2191, 2009. +% % Centre for Digital Music, Queen Mary, University of London. % This file copyright 2011 Ivan Damnjanovic. % diff -r c38d965b5a1d -r 4337e28183f1 DL/Majorization Minimization DL/wrapper_mm_solver.m --- a/DL/Majorization Minimization DL/wrapper_mm_solver.m Thu Mar 22 15:37:45 2012 +0000 +++ b/DL/Majorization Minimization DL/wrapper_mm_solver.m Fri Mar 23 20:48:25 2012 +0000 @@ -4,11 +4,24 @@ % Function gets as input % b - measurement vector % A - dictionary -% param - structure containing additional parameters +% param - structure containing additional parameters. These are: +% - initcoeff Initial guess for the coefficients +% (optional) +% - to 1/(step size). It is larger than spectral norm +% of dictionary A (default is 0.1+(svds(A,1))^2) +% - lambda Lagrangian multiplier. Regulates shrinkage +% (default is 0.4) +% - iternum Inner-loop maximum iteration number +% (default is 1000) +% - epsilon Stopping criterion for iterative softthresholding +% (default is 1e-7) +% - map Debiasing. 0 = No, 1 = Yes (default is 0) +% % Output: % x - sparse solution % cost - Objective cost +% % Centre for Digital Music, Queen Mary, University of London. % This file copyright 2011 Ivan Damnjanovic. % diff -r c38d965b5a1d -r 4337e28183f1 DL/RLS-DLA/SMALL_rlsdla.m --- a/DL/RLS-DLA/SMALL_rlsdla.m Thu Mar 22 15:37:45 2012 +0000 +++ b/DL/RLS-DLA/SMALL_rlsdla.m Fri Mar 23 20:48:25 2012 +0000 @@ -26,9 +26,8 @@ % - RLS-DLA - Skretting, K.; Engan, K.; , "Recursive Least Squares % Dictionary Learning Algorithm," Signal Processing, IEEE Transactions on, % vol.58, no.4, pp.2121-2130, April 2010 + % - - % Centre for Digital Music, Queen Mary, University of London. % This file copyright 2011 Ivan Damnjanovic. % diff -r c38d965b5a1d -r 4337e28183f1 examples/MajorizationMinimization tests/SMALL_AudioDenoise_DL_test_KSVDvsSPAMS.m --- a/examples/MajorizationMinimization tests/SMALL_AudioDenoise_DL_test_KSVDvsSPAMS.m Thu Mar 22 15:37:45 2012 +0000 +++ b/examples/MajorizationMinimization tests/SMALL_AudioDenoise_DL_test_KSVDvsSPAMS.m Fri Mar 23 20:48:25 2012 +0000 @@ -4,7 +4,7 @@ % It calls generateAudioDenoiseProblem that will let you to choose audio file, % add noise and use noisy audio to generate training set for dictionary % learning. -% + % % Centre for Digital Music, Queen Mary, University of London. % This file copyright 2011 Ivan Damnjanovic. diff -r c38d965b5a1d -r 4337e28183f1 toolboxes/alps/wrapper_ALPS_toolbox.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/toolboxes/alps/wrapper_ALPS_toolbox.m Fri Mar 23 20:48:25 2012 +0000 @@ -0,0 +1,106 @@ +function [x , numiter, time, x_path] = wrapper_ALPS_toolbox(b, A, param) +%% SMALL wrapper for ALPS toolbox +% +% Function gets as input +% b - measurement vector +% A - dictionary +% K - desired sparsity level +% param - structure containing additional parameters. These are: +% - memory Memory (momentum) of proposed algorithm. +% Possible values are 0,1,'infty' for memoryless, +% one memory and infinity memory ALPS, +% respectively. Default value: memory = 0. +% - tol Early stopping tolerance. Default value: tol = +% 1-e5. +% - ALPSiters Maximum number of algorithm iterations. Default +% value: 300. +% - mod According to [1], possible values are +% [0,1,2,4,5,6]. This value comes from the binary +% representation of the parameters: +% (solveNewtob, gradientDescentx, solveNewtonx), +% which are explained next. Default value = 0. +% - mu Variable that controls the step size selection. +% When mu = 0, step size is computed adaptively +% per iteration. Default value: mu = 0. +% - tau Variable that controls the momentum in +% non-memoryless case. Ignored in memoryless +% case. User can insert as value a function handle on tau. +% Description given below. Default value: tau = -1. +% - CGiters Maximum iterations for Conjugate-Gradients method. +% - CGtol Tolerance variable for Conjugate-Gradients method. +% - verbose verbose = 1 prints out execution infromation. +% Output: +% x - sparse solution +% numiter - number of iterations +% time - time needed to solve the problem# +% x_path - matrix containing x after every iteration +% +% For more details see AlgebraicPursuit.m. + +% +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 2011 Ivan Damnjanovic. +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License as +% published by the Free Software Foundation; either version 2 of the +% License, or (at your option) any later version. See the file +% COPYING included with this distribution for more information. +% +%% + +if isfield(param, 'sparsity') + sparsity = param.sparsity; +else + printf('\nAlebraic Pursuit algorithms require desired sparsity level.\n("sparsity" field in solver parameters structure)\n '); + return +end + +if isfield(param, 'memory') + memory = param.memory; +else + memory = 0; +end + +if isfield(param, 'mode') + mode = param.mode; +else + mode = 0; +end +if isfield(param, 'tolerance') + tolerance = param.tolerance; +else + tolerance = 1e-5; +end +if isfield(param, 'iternum') + iternum = param.iternum; +else + iternum = 300; +end +if isfield(param, 'verbose') + verbose = param.verbose; +else + verbose = 0; +end +if isfield(param, 'tau') + tau = param.tau; +else + tau = 1/2; +end +if isfield(param, 'useCG') + useCG = param.useCG; +else + useCG = 0; +end +if isfield(param, 'mu') + mu = param.mu; +else + mu = 0; +end +training_size = size(b,2); +x=zeros(size(A,2),training_size); +for i = 1:training_size + [x(:,i), numiter, time, x_path] = AlgebraicPursuit(b(:,i), A, sparsity, 'memory', memory,... + 'mode', mode, 'tolerance', tolerance, 'ALPSiterations', iternum, ... + 'verbose', verbose, 'tau', tau, 'useCG', useCG, 'mu', mu); +end \ No newline at end of file diff -r c38d965b5a1d -r 4337e28183f1 toolboxes/wrapper_ALPS_toolbox.m --- a/toolboxes/wrapper_ALPS_toolbox.m Thu Mar 22 15:37:45 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -function [x , numiter, time, x_path] = wrapper_ALPS_toolbox(b, A, param) -%% SMALL wrapper for ALPS toolbox -% -% Function gets as input -% b - measurement vector -% A - dictionary -% K - desired sparsity level -% param - structure containing additional parameters -% Output: -% x - sparse solution -% numiter - number of iterations -% time - time needed to solve the problem# -% x_path - matrix containing x after every iteration - -% Centre for Digital Music, Queen Mary, University of London. -% This file copyright 2011 Ivan Damnjanovic. -% -% This program is free software; you can redistribute it and/or -% modify it under the terms of the GNU General Public License as -% published by the Free Software Foundation; either version 2 of the -% License, or (at your option) any later version. See the file -% COPYING included with this distribution for more information. -% -%% - -if isfield(param, 'sparsity') - sparsity = param.sparsity; -else - printf('\nAlebraic Pursuit algorithms require desired sparsity level.\n("sparsity" field in solver parameters structure)\n '); - return -end - -if isfield(param, 'memory') - memory = param.memory; -else - memory = 0; -end - -if isfield(param, 'mode') - mode = param.mode; -else - mode = 0; -end -if isfield(param, 'tolerance') - tolerance = param.tolerance; -else - tolerance = 1e-5; -end -if isfield(param, 'iternum') - iternum = param.iternum; -else - iternum = 300; -end -if isfield(param, 'verbose') - verbose = param.verbose; -else - verbose = 0; -end -if isfield(param, 'tau') - tau = param.tau; -else - tau = 1/2; -end -if isfield(param, 'useCG') - useCG = param.useCG; -else - useCG = 0; -end -if isfield(param, 'mu') - mu = param.mu; -else - mu = 0; -end -training_size = size(b,2); -x=zeros(size(A,2),training_size); -for i = 1:training_size - [x(:,i), numiter, time, x_path] = AlgebraicPursuit(b(:,i), A, sparsity, 'memory', memory,... - 'mode', mode, 'tolerance', tolerance, 'ALPSiterations', iternum, ... - 'verbose', verbose, 'tau', tau, 'useCG', useCG, 'mu', mu); -end \ No newline at end of file