Mercurial > hg > smallbox
comparison util/SMALL_learn.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 | 83af80baf959 |
children | f3b6ddd2f04f |
comparison
equal
deleted
inserted
replaced
198:83af80baf959 | 199:751fa3bddd30 |
---|---|
1 function DL = SMALL_learn(Problem,DL) | 1 function DL = SMALL_learn(Problem,DL) |
2 %% SMALL Dictionary Learning | 2 %% SMALL Dictionary Learning |
3 % | 3 % |
4 % Function gets as input Problem and Dictionary Learning (DL) structures | 4 % Function gets as input Problem and Dictionary Learning (DL) structures |
5 % In Problem structure field b with the training set needs to be defined | 5 % In Problem structure field b with the training set needs to be defined |
6 % In DL fields with name of the toolbox and solver, and parameters file | 6 % In DL fields with name of the toolbox and solver, and parameters file |
7 % for particular dictionary learning technique needs to be present. | 7 % for particular dictionary learning technique needs to be present. |
8 % | 8 % |
9 % Outputs are Learned dictionary and time spent as a part of DL structure | 9 % Outputs are Learned dictionary and time spent as a part of DL structure |
10 | 10 |
11 % | 11 % |
16 % modify it under the terms of the GNU General Public License as | 16 % modify it under the terms of the GNU General Public License as |
17 % published by the Free Software Foundation; either version 2 of the | 17 % published by the Free Software Foundation; either version 2 of the |
18 % License, or (at your option) any later version. See the file | 18 % License, or (at your option) any later version. See the file |
19 % COPYING included with this distribution for more information. | 19 % COPYING included with this distribution for more information. |
20 %% | 20 %% |
21 | |
21 global SMALL_path | 22 global SMALL_path |
23 | |
22 if (DL.profile) | 24 if (DL.profile) |
23 fprintf('\nStarting Dictionary Learning %s... \n', DL.name); | 25 fprintf('\nStarting Dictionary Learning %s... \n', DL.name); |
24 end | 26 end |
25 start=cputime; | 27 |
26 tStart=tic; | 28 start=cputime; |
27 | 29 tStart=tic; |
28 % configuration file | 30 |
29 run(fullfile(SMALL_path, 'config/SMALL_learn_config.m')); | 31 % toolboxes configuration file |
30 | 32 run(fullfile(SMALL_path, 'config/SMALL_learn_config.m')); |
33 | |
31 %% | 34 %% |
32 % Dictionary Learning time | 35 % Dictionary Learning time |
33 tElapsed=toc(tStart); | 36 tElapsed=toc(tStart); |
34 DL.time = cputime - start; | 37 DL.time = cputime - start; |
35 if (DL.profile) | 38 if (DL.profile) |
36 fprintf('\n%s finished task in %2f seconds (cpu time). \n', DL.name, DL.time); | 39 fprintf('\n%s finished task in %2f seconds (cpu time). \n', DL.name, DL.time); |
37 fprintf('\n%s finished task in %2f seconds (tic-toc time). \n', DL.name, tElapsed); | 40 fprintf('\n%s finished task in %2f seconds (tic-toc time). \n', DL.name, tElapsed); |
38 end | 41 end |
39 DL.time=tElapsed; | 42 DL.time=tElapsed; |
40 % If dictionary is given as a sparse matrix change it to full | 43 % If dictionary is given as a sparse matrix change it to full |
41 | 44 |
42 DL.D = full(D); | 45 DL.D = full(D); |
43 | 46 |
44 end | 47 end |
45 | 48 |