Mercurial > hg > smallbox
changeset 36:e6191f5bb21b
(none)
author | idamnjanovic |
---|---|
date | Mon, 14 Mar 2011 15:32:52 +0000 |
parents | ea9ef4bd7102 |
children | d80c103d9876 |
files | util/SMALL_learn.m |
diffstat | 1 files changed, 29 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/util/SMALL_learn.m Mon Mar 14 15:32:30 2011 +0000 +++ b/util/SMALL_learn.m Mon Mar 14 15:32:52 2011 +0000 @@ -20,12 +20,12 @@ fprintf('\nStarting Dictionary Learning %s... \n', DL.name); start=cputime; - + tStart=tic; if strcmpi(DL.toolbox,'KSVD') param=DL.param; param.data=Problem.b; - D = eval([DL.name,'(param, ''t'', 5);']); + D = eval([DL.name,'(param)']);%, ''t'', 5);']); elseif strcmpi(DL.toolbox,'KSVDS') param=DL.param; param.data=Problem.b; @@ -44,7 +44,31 @@ for i = 1: size(D,2) D(:,i)=D(:,i)/norm(D(:,i)); end + elseif strcmpi(DL.toolbox,'SMALL') + X = Problem.b; + param=DL.param; + + D = eval([DL.name,'(X, param);']); + % we need to make sure that columns are normalised to + % unit lenght. + + for i = 1: size(D,2) + D(:,i)=D(:,i)/norm(D(:,i)); + end + elseif strcmpi(DL.toolbox,'mpv2') + X = Problem.b(:,1:1:40000); + jD0 = mpv2.SimpleMatrix(DL.param.D); + jDicLea = mpv2.DictionaryLearning(jD0, 1,1); +% !!!!! MAYBE lambda is not needed for ILS - NEED TO CHECK!!!! + jDicLea.setLambda('L', DL.param.lambda, DL.param.lambda, 1000); + jDicLea.setVerbose(2); + jDicLea.setORMP(16, 1e-6, DL.param.abs); + eval(['jDicLea.',DL.name,'( X(:), DL.param.iternum );']); + jD = jDicLea.getDictionary(); + + D = reshape(jD.getAll(), size(X,1), DL.param.K); + % To introduce new dictionary learning technique put the files in % your Matlab path. Next, unique name <TolboxID> for your toolbox needs % to be defined and also prefferd API for toolbox functions <Preffered_API> @@ -69,10 +93,11 @@ %% % Dictionary Learning time - +tElapsed=toc(tStart); DL.time = cputime - start; fprintf('\n%s finished task in %2f seconds. \n', DL.name, DL.time); - + fprintf('\n%s finished task in %2f seconds. \n', DL.name, tElapsed); +DL.time=tElapsed; % If dictionary is given as a sparse matrix change it to full DL.D = full(D);