annotate util/SMALL_learn.m @ 247:ecce33192fcc tip

Added tag ver_2.1 for changeset cef4500b936f
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Wed, 31 Oct 2012 12:24:44 +0000
parents 198d4d9cee74
children
rev   line source
idamnjanovic@8 1 function DL = SMALL_learn(Problem,DL)
luis@199 2 %% SMALL Dictionary Learning
luis@199 3 %
luis@199 4 % Function gets as input Problem and Dictionary Learning (DL) structures
ivan@121 5 % In Problem structure field b with the training set needs to be defined
luis@199 6 % In DL fields with name of the toolbox and solver, and parameters file
ivan@121 7 % for particular dictionary learning technique needs to be present.
ivan@121 8 %
ivan@121 9 % Outputs are Learned dictionary and time spent as a part of DL structure
ivan@121 10
idamnjanovic@24 11 %
idamnjanovic@24 12 % Centre for Digital Music, Queen Mary, University of London.
idamnjanovic@24 13 % This file copyright 2009 Ivan Damnjanovic.
idamnjanovic@24 14 %
idamnjanovic@24 15 % This program is free software; you can redistribute it and/or
idamnjanovic@24 16 % modify it under the terms of the GNU General Public License as
idamnjanovic@24 17 % published by the Free Software Foundation; either version 2 of the
idamnjanovic@24 18 % License, or (at your option) any later version. See the file
idamnjanovic@24 19 % COPYING included with this distribution for more information.
idamnjanovic@8 20 %%
luis@199 21
luis@216 22 SMALLboxInit
luis@203 23
ivan@152 24 if (DL.profile)
luis@199 25 fprintf('\nStarting Dictionary Learning %s... \n', DL.name);
ivan@152 26 end
luis@199 27
luis@199 28 start=cputime;
luis@199 29 tStart=tic;
luis@199 30
luis@228 31 %% toolbox configuration
luis@228 32 % test if there is a locally modified version of the config
luis@228 33 % otherwise reads the "default" config file
luis@228 34 if exist(fullfile(SMALL_path, 'config/SMALL_learn_config_local.m'), 'file') == 2
luis@228 35 printf('\n\nSMALL_learn: Using local configuration file.\n\n');
luis@228 36 run(fullfile(SMALL_path, 'config/SMALL_learn_config_local.m'));
luis@228 37 else
luis@228 38 printf('\n\nSMALL_learn: Using default configuration file.\n\n');
luis@228 39 run(fullfile(SMALL_path, 'config/SMALL_learn_config.m'));
luis@228 40 end
luis@199 41
idamnjanovic@8 42 %%
idamnjanovic@8 43 % Dictionary Learning time
idamnjanovic@36 44 tElapsed=toc(tStart);
ivan@152 45 DL.time = cputime - start;
ivan@152 46 if (DL.profile)
luis@199 47 fprintf('\n%s finished task in %2f seconds (cpu time). \n', DL.name, DL.time);
luis@199 48 fprintf('\n%s finished task in %2f seconds (tic-toc time). \n', DL.name, tElapsed);
ivan@152 49 end
idamnjanovic@36 50 DL.time=tElapsed;
luis@199 51 % If dictionary is given as a sparse matrix change it to full
idamnjanovic@8 52
luis@199 53 DL.D = full(D);
luis@199 54
idamnjanovic@8 55 end
luis@199 56