Home > dal > s_test_gl.m

s_test_gl

PURPOSE ^

% Example of squared-loss-groued-L1 DAL on a synthetic problem (non-sparse)

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

% Example of squared-loss-groued-L1 DAL on a synthetic problem (non-sparse)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% Example of squared-loss-groued-L1 DAL on a synthetic problem (non-sparse)
0002 
0003 m = 1024; ns = 64; nc=64;
0004 gmax=@(x)max(sqrt(sum(reshape(x,[ns,nc]).^2)));
0005 A=randn(m,ns,nc);
0006 w0=randn(ns,nc);
0007 bb=A(:,:)*w0(:)+randn(m,1);
0008 lambda=0.5*gmax(A(:,:)'*bb);
0009 
0010 lambda = lambda*[1 0.1 0.01 1e-3 1e-4];
0011 time   = zeros(size(lambda));
0012 spar   = zeros(size(lambda));
0013 xx     = zeros(ns*nc,length(lambda));
0014 t0     = cputime;
0015 xx1    = zeros(ns,nc);
0016 for ii=1:length(lambda)
0017   [xx1,stat]=dalsqgl(xx1,A(:,:),bb,lambda(ii),'display',3);
0018   xx(:,ii)=xx1(:);
0019   time(ii)=cputime-t0;
0020   spec    =sqrt(sum(xx1.^2));
0021   spar(ii)=sum(spec>10*median(spec))/nc;
0022   fprintf('lambda=%g sparsity=%g%% time=%g\n',lambda(ii), spar(ii)*100, time(ii));
0023 end
0024 
0025 
0026

Generated on Sat 22-Aug-2009 22:15:36 by m2html © 2003