annotate config/SMALL_learn_config.m @ 199:751fa3bddd30 luisf_dev

Added config file for SMALL_solve (removed the if/else code from SMALL_solve); added headers to both config files;
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Tue, 20 Mar 2012 14:28:51 +0000
parents 759313488e7b
children 198d4d9cee74
rev   line source
luis@199 1 %% Configuration file used in SMALL_learn
luis@199 2 %
luis@199 3 % Use this file to change the dictionary learning algorithms in SMALLBox
luis@199 4 % Please refer to the documentation before editing this file
luis@190 5
luis@199 6 % Centre for Digital Music, Queen Mary, University of London.
luis@199 7 % This file copyright 2009 Ivan Damnjanovic.
luis@199 8 %
luis@199 9 % This program is free software; you can redistribute it and/or
luis@199 10 % modify it under the terms of the GNU General Public License as
luis@199 11 % published by the Free Software Foundation; either version 2 of the
luis@199 12 % License, or (at your option) any later version. See the file
luis@199 13 % COPYING included with this distribution for more information.
luis@199 14 %
luis@199 15 %%
luis@190 16
luis@199 17 if strcmpi(DL.toolbox,'KSVD')
luis@199 18 param=DL.param;
luis@190 19 param.data=Problem.b;
luis@199 20
luis@190 21 D = eval([DL.name,'(param)']);%, ''t'', 5);']);
luis@199 22 elseif strcmpi(DL.toolbox,'KSVDS')
luis@199 23 param=DL.param;
luis@190 24 param.data=Problem.b;
luis@190 25
luis@190 26 D = eval([DL.name,'(param, ''t'', 5);']);
luis@199 27 elseif strcmpi(DL.toolbox,'SPAMS')
luis@190 28
luis@199 29 X = Problem.b;
luis@190 30 param=DL.param;
luis@190 31
luis@190 32 D = eval([DL.name,'(X, param);']);
luis@190 33 % As some versions of SPAMS does not produce unit norm column
luis@190 34 % dictionaries, we need to make sure that columns are normalised to
luis@190 35 % unit lenght.
luis@190 36
luis@190 37 for i = 1: size(D,2)
luis@190 38 D(:,i)=D(:,i)/norm(D(:,i));
luis@190 39 end
luis@199 40 elseif strcmpi(DL.toolbox,'SMALL')
luis@190 41
luis@199 42 X = Problem.b;
luis@190 43 param=DL.param;
luis@190 44
luis@190 45 D = eval([DL.name,'(X, param);']);
luis@190 46 % we need to make sure that columns are normalised to
luis@190 47 % unit lenght.
luis@190 48
luis@190 49 for i = 1: size(D,2)
luis@190 50 D(:,i)=D(:,i)/norm(D(:,i));
luis@190 51 end
luis@190 52
luis@199 53 elseif strcmpi(DL.toolbox,'TwoStepDL')
luis@199 54
luis@190 55 DL=SMALL_two_step_DL(Problem, DL);
luis@190 56
luis@190 57 % we need to make sure that columns are normalised to
luis@190 58 % unit lenght.
luis@190 59
luis@190 60 for i = 1: size(DL.D,2)
luis@190 61 DL.D(:,i)=DL.D(:,i)/norm(DL.D(:,i));
luis@190 62 end
luis@190 63 D = DL.D;
luis@190 64
luis@190 65 elseif strcmpi(DL.toolbox,'MMbox')
luis@199 66
luis@190 67 DL = wrapper_mm_DL(Problem, DL);
luis@190 68
luis@190 69 % we need to make sure that columns are normalised to
luis@190 70 % unit lenght.
luis@190 71
luis@190 72 for i = 1: size(DL.D,2)
luis@190 73 DL.D(:,i)=DL.D(:,i)/norm(DL.D(:,i));
luis@190 74 end
luis@199 75 D = DL.D;
luis@199 76
luis@190 77 % To introduce new dictionary learning technique put the files in
luis@199 78 % your Matlab path. Next, unique name <TolboxID> for your toolbox needs
luis@190 79 % to be defined and also prefferd API for toolbox functions <Preffered_API>
luis@199 80 %
luis@190 81 % elseif strcmpi(DL.toolbox,'<ToolboxID>')
luis@190 82 % % This is an example of API that can be used:
luis@190 83 % % - get training set from Problem part of structure
luis@190 84 % % - assign parameters defined in the main program
luis@190 85 %
luis@199 86 % X = Problem.b;
luis@190 87 % param=DL.param;
luis@190 88 %
luis@190 89 % % - Evaluate the function (DL.name - defined in the main) with
luis@190 90 % % parameters given above
luis@190 91 %
luis@190 92 % D = eval([DL.name,'(<Preffered_API>);']);
luis@190 93
luis@199 94 else
luis@190 95 printf('\nToolbox has not been registered. Please change SMALL_learn file.\n');
luis@190 96 return
luis@199 97 end