Home > dal > dalsqgl.m

dalsqgl

PURPOSE ^

dalsqgl - DAL with squared loss and grouped L1 regularization

SYNOPSIS ^

function [ww,status]=dalsqgl(ww, A, bb, lambda, varargin)

DESCRIPTION ^

 dalsqgl - DAL with squared loss and grouped L1 regularization

 Overview:
  Solves the optimization problem:
   xx = argmin ||A*x-bb||^2 + lambda*||x||_G1
  where
   ||x||_G1 = sum(sqrt(sum(xx.^2)))
  (grouped L1 norm)

 Syntax:
  [xx,status]=dalsqgl(xx, A, bb, lambda, <opt>)

 Inputs:
  xx     : initial solution ([ns,nc] or [nn,1] with opt.blks)
  A      : the design matrix A ([mm,nn] or [mm,ns,nc])
  bb     : the target vector ([mm,1])
  lambda : the regularization constant
  <opt>  : list of 'fieldname1', value1, 'filedname2', value2, ...
   blks     : vector with elements corresponding to the size of
              the blocks. If omitted, opt.blks = [ns, ns,..., ns],
              where nc is the number of blocks.
   stopcond : stopping condition, which can be
              'pdg'  : Use relative primal dual gap (default)
              'fval' : Use the objective function value
           (see dal.m for other options)
 Outputs:
  xx     : the final solution ([ns,nc] or [nn,1])
  status : various status values

 Copyright(c) 2009 Ryota Tomioka
 This software is distributed under the MIT license. See license.txt

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % dalsqgl - DAL with squared loss and grouped L1 regularization
0002 %
0003 % Overview:
0004 %  Solves the optimization problem:
0005 %   xx = argmin ||A*x-bb||^2 + lambda*||x||_G1
0006 %  where
0007 %   ||x||_G1 = sum(sqrt(sum(xx.^2)))
0008 %  (grouped L1 norm)
0009 %
0010 % Syntax:
0011 %  [xx,status]=dalsqgl(xx, A, bb, lambda, <opt>)
0012 %
0013 % Inputs:
0014 %  xx     : initial solution ([ns,nc] or [nn,1] with opt.blks)
0015 %  A      : the design matrix A ([mm,nn] or [mm,ns,nc])
0016 %  bb     : the target vector ([mm,1])
0017 %  lambda : the regularization constant
0018 %  <opt>  : list of 'fieldname1', value1, 'filedname2', value2, ...
0019 %   blks     : vector with elements corresponding to the size of
0020 %              the blocks. If omitted, opt.blks = [ns, ns,..., ns],
0021 %              where nc is the number of blocks.
0022 %   stopcond : stopping condition, which can be
0023 %              'pdg'  : Use relative primal dual gap (default)
0024 %              'fval' : Use the objective function value
0025 %           (see dal.m for other options)
0026 % Outputs:
0027 %  xx     : the final solution ([ns,nc] or [nn,1])
0028 %  status : various status values
0029 %
0030 % Copyright(c) 2009 Ryota Tomioka
0031 % This software is distributed under the MIT license. See license.txt
0032 
0033 function [ww,status]=dalsqgl(ww, A, bb, lambda, varargin)
0034 
0035 opt=propertylist2struct(varargin{:});
0036 opt=set_defaults(opt,'solver','nt',...
0037                      'stopcond','pdg',...
0038                      'blks',[]);
0039 
0040 if isempty(opt.blks)
0041   opt.blks=size(ww,1)*ones(1,size(ww,2));
0042   ww = ww(:);
0043 end
0044 
0045 prob.floss    = struct('p',@loss_sqp,'d',@loss_sqd,'args',{{bb}});
0046 prob.fspec    = {@gl_spec, opt.blks};
0047 prob.dnorm    = {@gl_dnorm,opt.blks};
0048 prob.obj      = @objdalgl;
0049 prob.softth   = @gl_softth;
0050 prob.stopcond = ['stopcond_' opt.stopcond];
0051 prob.ll       = -inf*ones(size(bb));
0052 prob.uu       = inf*ones(size(bb));
0053 prob.Ac       =[];
0054 prob.bc       =[];
0055 prob.info     = struct('blks',opt.blks);
0056 
0057 if isequal(opt.solver,'cg')
0058   prob.hessMult = @hessMultdalgl;
0059 end
0060 
0061 if isequal(opt.stopcond,'fval')
0062   opt.feval = 1;
0063 end
0064 
0065 [mm,nn]=size(A);
0066 prob.mm       = mm;
0067 prob.nn       = nn;
0068 
0069 [ww,uu,status]=dal(prob,ww,[],A,[],lambda,opt);
0070 
0071 if all(opt.blks==opt.blks(1))
0072   ns=opt.blks(1);
0073   nc=length(ww)/ns;
0074   ww=reshape(ww, [ns,nc]);
0075 end

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