[学习]L1 Homotopy for L1 norm minimization

L1 Homotopy: A MATLAB Toolbox for Homotopy Algorithms in L1 Norm Minimization Problems

  Introduction:

 

This package is a collection of MATLAB routines for solving some L1 norm minimization problems using homotopy techniques. These problems are usually encountered in the recovery of sparse signals from linear incoherent measurements.

 

This package contains scripts for solving the following optimization problems:

 

·        Basis pursuit denoising (BPDN) / LASSO

·        Dantzig selector

·        L1 decoding, robust L1 decoding

·        Re-weighted L1-norm (iterative and adaptive reweighting)

 

In addition to solving these problems for any given set of parameters, we have some dynamic algorithms to update their solution when

 

·        Streaming signal recovery

·        New measurements are sequentially added to the system

·        The unknown signal varies over time and we get a new measurement vector

 

Download:

 

Homotopy package

·        Version 2.0 (zip) released June 2013

o   A single, versatile homotopy program that can solve a variety of dynamic updating problems.

o   We consider the following linear model of observations:

where  is a sparse vector of interest,  is the system matrix,  is the measurement vector, and

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
l1_homotopy”函数是一个MATLAB程序包,用于求解一般L1最小化问题,其代码如下: ```matlab function [x,status,history] = l1_homotopy(A, b, lambda, opts) % l1_homotopy: Solve L1-regularized least squares problem % [x,status,history] = l1_homotopy(A, b, lambda, opts) % % Solves the problem % minimize || A*x - b ||_2^2 + lambda * || x ||_1 % using a homotopy method that tracks the solution path as lambda decreases % from infinity to lambda. The solution is returned in the vector x. % % The "status" output gives the status of the solver: % status = 0: the solution is known to be exact. % status = 1: the solution is known to be accurate to within the given % tolerance tol. % status = 2: the solution is accurate to within a certain tolerance, % but the algorithm did not converge. % status = 3: the algorithm did not converge and did not find a solution. % % The "history" output is a structure containing the following fields: % iter: the iteration number % obj: the objective function value at each iteration % gap: the duality gap at each iteration % time: the time elapsed at each iteration % % The input "opts" is a structure that can contain the following fields: % tol: the convergence tolerance (default: 1e-6) % maxiter: the maximum number of iterations (default: 1000) % x0: an initial guess for x (default: all zeros) % print: whether to print progress information (default: 0) % update: how often to update the progress information (default: 10) % stopcond: the stopping condition to use (default: 3) % 1 = || x_k - x_k-1 ||_2 / || x_k ||_2 < tol % 2 = || x_k - x_k-1 ||_2 < tol % 3 = duality gap < tol % % Example usage: % n = 1000; p = 200; % A = randn(p,n); x0 = sprandn(n,1,0.1); b = A*x0 + 0.01*randn(p,1); % lambda = 0.1; % [x,status,history] = l1_homotopy(A, b, lambda); % % Written by: Justin Romberg, Caltech % Email: jrom@acm.caltech.edu % Created: February 2007 t0 = tic; % Set default options if nargin < 4 opts = struct(); end if ~isfield(opts, 'tol') opts.tol = 1e-6; end if ~isfield(opts, 'maxiter') opts.maxiter = 1000; end if ~isfield(opts, 'x0') opts.x0 = []; end if ~isfield(opts, 'print') opts.print = 0; end if ~isfield(opts, 'update') opts.update = 10; end if ~isfield(opts, 'stopcond') opts.stopcond = 3; end % Initialize solver [m,n] = size(A); x = zeros(n,1); if ~isempty(opts.x0) x = opts.x0; end w = x; v = zeros(m,1); gamma = 0; delta = 0; obj = 0.5 * norm(b - A*x)^2; gap = 0; iter = 0; history.iter = iter; history.obj = obj; history.gap = gap; history.time = 0; status = 3; % Compute initial values of quantities Atb = A'*b; AtA = A'*A; norm_w = norm(w); norm_v = norm(v); % Main loop while iter < opts.maxiter iter = iter + 1; % Update w and v w_old = w; v_old = v; [w,v,gamma,delta] = l1_homotopy_update(A, b, Atb, AtA, w, v, gamma, delta, lambda); % Compute objective value and duality gap obj_old = obj; obj = 0.5 * norm(b - A*x)^2 + lambda * norm(w,1); gap = abs(obj - gamma); % Update x x_old = x; x = w; % Compute convergence criteria if opts.stopcond == 1 crit = norm(x - x_old, 2) / norm(x, 2); elseif opts.stopcond == 2 crit = norm(x - x_old, 2); elseif opts.stopcond == 3 crit = gap; end % Save history information history.iter(iter) = iter; history.obj(iter) = obj; history.gap(iter) = gap; history.time(iter) = toc(t0); % Print progress information if opts.print && (mod(iter, opts.update) == 0 || iter == 1 || iter == opts.maxiter) fprintf('Iteration %d: obj = %0.6g, gap = %0.6g, crit = %0.6g\n', iter, obj, gap, crit); end % Check stopping criteria if crit < opts.tol status = 0; break; end end % Set status and final history information if status == 3 if gap < opts.tol status = 1; else status = 2; end end history.iter = history.iter(1:iter); history.obj = history.obj(1:iter); history.gap = history.gap(1:iter); history.time = history.time(1:iter); ``` 这个函数的输入包括:矩阵A和向量b(表示L1最小化问题),正则化参数lambda,以及一些选项opts(包括收敛容差、最大迭代次数、初始猜测、输出选项等)。输出包括:解向量x、状态status和历史记录history。函数中使用了一个“l1_homotopy_update”函数来更新w、v、gamma和delta等变量。主要的求解过程在主循环中进行。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值