comparison config/SMALL_learn_config.m @ 220:0d30f9074dd9

Merge
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Wed, 11 Apr 2012 15:56:39 +0100
parents 751fa3bddd30
children 198d4d9cee74
comparison
equal deleted inserted replaced
165:775caafd5651 220:0d30f9074dd9
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
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 %%
16
17 if strcmpi(DL.toolbox,'KSVD')
18 param=DL.param;
19 param.data=Problem.b;
20
21 D = eval([DL.name,'(param)']);%, ''t'', 5);']);
22 elseif strcmpi(DL.toolbox,'KSVDS')
23 param=DL.param;
24 param.data=Problem.b;
25
26 D = eval([DL.name,'(param, ''t'', 5);']);
27 elseif strcmpi(DL.toolbox,'SPAMS')
28
29 X = Problem.b;
30 param=DL.param;
31
32 D = eval([DL.name,'(X, param);']);
33 % As some versions of SPAMS does not produce unit norm column
34 % dictionaries, we need to make sure that columns are normalised to
35 % unit lenght.
36
37 for i = 1: size(D,2)
38 D(:,i)=D(:,i)/norm(D(:,i));
39 end
40 elseif strcmpi(DL.toolbox,'SMALL')
41
42 X = Problem.b;
43 param=DL.param;
44
45 D = eval([DL.name,'(X, param);']);
46 % we need to make sure that columns are normalised to
47 % unit lenght.
48
49 for i = 1: size(D,2)
50 D(:,i)=D(:,i)/norm(D(:,i));
51 end
52
53 elseif strcmpi(DL.toolbox,'TwoStepDL')
54
55 DL=SMALL_two_step_DL(Problem, DL);
56
57 % we need to make sure that columns are normalised to
58 % unit lenght.
59
60 for i = 1: size(DL.D,2)
61 DL.D(:,i)=DL.D(:,i)/norm(DL.D(:,i));
62 end
63 D = DL.D;
64
65 elseif strcmpi(DL.toolbox,'MMbox')
66
67 DL = wrapper_mm_DL(Problem, DL);
68
69 % we need to make sure that columns are normalised to
70 % unit lenght.
71
72 for i = 1: size(DL.D,2)
73 DL.D(:,i)=DL.D(:,i)/norm(DL.D(:,i));
74 end
75 D = DL.D;
76
77 % To introduce new dictionary learning technique put the files in
78 % your Matlab path. Next, unique name <TolboxID> for your toolbox needs
79 % to be defined and also prefferd API for toolbox functions <Preffered_API>
80 %
81 % elseif strcmpi(DL.toolbox,'<ToolboxID>')
82 % % This is an example of API that can be used:
83 % % - get training set from Problem part of structure
84 % % - assign parameters defined in the main program
85 %
86 % X = Problem.b;
87 % param=DL.param;
88 %
89 % % - Evaluate the function (DL.name - defined in the main) with
90 % % parameters given above
91 %
92 % D = eval([DL.name,'(<Preffered_API>);']);
93
94 else
95 printf('\nToolbox has not been registered. Please change SMALL_learn file.\n');
96 return
97 end