Mercurial > hg > smallbox
comparison DL/Majorization Minimization DL/ExactDicoRecovery/mapdl_cn.m @ 159:23763c5fbda5 danieleb
Merge
author | Daniele Barchiesi <daniele.barchiesi@eecs.qmul.ac.uk> |
---|---|
date | Wed, 31 Aug 2011 10:43:32 +0100 |
parents | b14209313ba4 |
children |
comparison
equal
deleted
inserted
replaced
158:855aa3288394 | 159:23763c5fbda5 |
---|---|
1 % Maximum A Posteriori Estimation 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 % res = dictionary constraint. 'un' = unit colomn norm, 'bn' = bounded colomn norm | |
7 function [Phiout,X,ert] = mapdl_cn(Y,Phi,lambda,IT,res) | |
8 maxIT = 1000; | |
9 [PhiN,PhiM] = size(Phi); | |
10 RR1 = PhiM; | |
11 %%%%%%%%%%%%%% | |
12 % [PhiM,L] = size(ud); | |
13 [PhiN,L] = size(Y); | |
14 X = ones(PhiM,L); | |
15 for it = 1:IT | |
16 to = .1+svds(Phi,1); | |
17 [PhiN,PhiM] = size(Phi); | |
18 %%%% | |
19 eps = 3*10^-4; | |
20 map = 1; % Projecting on the selected space (0=no,1=yes) | |
21 [X,l1err] = mm1(Phi,Y,X,to,lambda,maxIT,eps,map); %% Sparse approximation with Iterative Soft-thresholding | |
22 ert(it) = l1err; | |
23 %%% | |
24 eps = 10^-7; | |
25 mu = 10^-4; | |
26 [Phi,X] = dict_update_MAP_cn(Phi,Y,X,mu,maxIT,eps,res); | |
27 end | |
28 Phiout = Phi; |