annotate toolboxes/distance_learning/mlr/thresh/threshFull_admmMixed.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function result = threshFull_admmMixed(R,lam);
wolffd@0 2 % return argmin_V lam*||V||_2,1 + 0.5 ||V - A||_F^2
wolffd@0 3 % symmetry constraint on V
wolffd@0 4
wolffd@0 5
wolffd@0 6
wolffd@0 7 W = R;
wolffd@0 8 V = eye(length(R));
wolffd@0 9 U = zeros(size(R));
wolffd@0 10 q = 1;
wolffd@0 11 mu = 100;
wolffd@0 12 mult = 2;
wolffd@0 13
wolffd@0 14 p = numel(R);
wolffd@0 15 n = numel(U);
wolffd@0 16 tol = 1e-4;
wolffd@0 17 ptol = tol * sqrt(p);
wolffd@0 18 dtol = tol * sqrt(n);
wolffd@0 19
wolffd@0 20 iter = 0;
wolffd@0 21 while 1
wolffd@0 22 iter = iter + 1;
wolffd@0 23 Vold = V;
wolffd@0 24 W = threshFull_mixed(((1*R+q*(V-U))/(1+q)),lam/(1+q));
wolffd@0 25 V = feasible_symm(W+U);
wolffd@0 26 U = U + W - V;
wolffd@0 27
wolffd@0 28 pr = q * norm( V(:)-Vold(:));
wolffd@0 29 dr = norm((W(:) - V(:)));
wolffd@0 30
wolffd@0 31 if pr < ptol && dr < dtol,break,end
wolffd@0 32
wolffd@0 33 if pr/dr > mu
wolffd@0 34 q = 1/mult * q;
wolffd@0 35 U = mult * U;
wolffd@0 36 % disp(['q = ' num2str(q)]);
wolffd@0 37 elseif dr/pr > mu
wolffd@0 38 q = mult * q;
wolffd@0 39 U = 1/mult * U;
wolffd@0 40 % disp(['q = ' num2str(q)]);
wolffd@0 41
wolffd@0 42 end
wolffd@0 43 end
wolffd@0 44 %disp(['Iterations: ' num2str(iter)]);
wolffd@0 45 %disp(['PR: ' num2str(pr) 'DR: ' num2str(dr)])
wolffd@0 46 result = V;
wolffd@0 47 end
wolffd@0 48
wolffd@0 49
wolffd@0 50
wolffd@0 51 function result = feasible_symm(A)
wolffd@0 52 result = 0.5*(A+A');
wolffd@0 53 end
wolffd@0 54
wolffd@0 55