Mercurial > hg > smallbox
comparison DL/Majorization Minimization DL/ExactDicoRecovery/ksvd_cn.m @ 155:b14209313ba4 ivand_dev
Integration of Majorization Minimisation Dictionary Learning
author | Ivan Damnjanovic lnx <ivan.damnjanovic@eecs.qmul.ac.uk> |
---|---|
date | Mon, 22 Aug 2011 11:46:35 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
154:0de08f68256b | 155:b14209313ba4 |
---|---|
1 % K-SVD algorithm for Dictionary Learning | |
2 % Y = input data (M X L matrix) | |
3 % Phi = initial dictionary (M X N), e.g. random dictionary or first N data samples | |
4 % lambda = regularization coefficient (||Phi*X-Y||_F)^2 + lambda*||X||_1 | |
5 % IT = number of iterations | |
6 function [Phiout,X,ert] = ksvd_cn(Y,Phi,lambda,IT) | |
7 maxIT = 1000; | |
8 [PhiN,PhiM] = size(Phi); | |
9 RR1 = PhiM; | |
10 %%%%%%%%%%%%%% | |
11 % [PhiM,L] = size(ud); | |
12 [PhiN,L] = size(Y); | |
13 X = ones(PhiM,L); | |
14 for it = 1:IT | |
15 to = .1+svds(Phi,1); | |
16 [PhiN,PhiM] = size(Phi); | |
17 %%%% | |
18 eps = 3*10^-4; | |
19 map = 1; % Projecting on the selected space (0=no,1=yes) | |
20 [X,l1err] = mm1(Phi,Y,X,to,lambda,maxIT,eps,map); %% Sparse approximation with Iterative Soft-thresholding | |
21 ert(it) = l1err; | |
22 %%% | |
23 [Phi,X] = dict_update_KSVD_cn(Phi,Y,X); | |
24 end | |
25 Phiout = Phi; |