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