annotate config/SMALL_learn_config.m @ 228:198d4d9cee74 luisf_dev

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