Giter VIP home page Giter VIP logo

spgl1's Introduction

SPGL1: A solver for large-scale sparse least squares

GitHub license DOI:10.1137/080714488

Introduction

SPGL1 is a Matlab solver for large-scale one-norm regularized least squares. It is designed to solve any of the following three problems:

  1. Basis pursuit denoise (BPDN): minimize ||x||_1 subject to ||Ax - b||_2 <= sigma,

  2. Basis pursuit (BP): minimize ||x||_1 subject to Ax = b

  3. Lasso: minimize ||Ax - b||_2 subject to ||x||_1 <= tau,

The matrix A can be defined explicily, or as an operator (i.e., a function) that return both both Ax and A'y. SPGL1 can solve these three problems in both the real and complex domains.

Home page: https://friedlander.io/spgl1

References ๐Ÿ““

The algorithm implemented by SPGL1 is described in the paper

  • E. van den Berg and M. P. Friedlander, "Probing the Pareto frontier for basis pursuit solutions", SIAM J. on Scientific Computing, 31(2):890-912, November 2008

spgl1's People

Contributors

crosspolytope avatar mpf avatar vegarant avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spgl1's Issues

SPGL1 Setup

I have a problem when setting it up. I moved the .m files to my path directory but had this error:

Could not compile oneProjector.You can still use the slower ".m" version.Error using rethrow
Input must be a structure.

Error in spgsetup (line 39)
    rethrow(lasterr);

I moved oneProjector file to my directory but still have the problem.
Do you have idea how I can fix this error? However, the spgdemo runs fine.

Thanks and best regards,
Ezz

Different machines provide different output

Hi,

My collaborator and I are getting wildly different answers for the same input.

I am using the version 1.8 and also the most recent build. Also, this seems to be independent of whether or not the mex files are compiled.

The data (and code) to test is here (public Google Docs link) but the code itself is also below

clear all % Just to make sure there is nothing messing with the solver

load('test_SPGL1_data')

opts = spgSetParms('verbosity',0,'iterations',2000,'optTol',1e-6,'bpTol',1e-8);
[x,~,~,info] = spg_bp(Psi,F,opts);

fprintf('System Solution Error: %.5e\n',rms(Psi*x - F))
fprintf('Signal Recovery Error: %.5e\n',rms(x0 - x))
fprintf('SPGL1 iter: %i  Exit Flag: %i\n',info.iter,info.stat)

The following is a compilation of results:

On my iMac (R2014a):

System Solution Error: 1.38103e-07
Signal Recovery Error: 4.00019e-07
SPGL1 iter: 537  Exit Flag: 1

On my laptop (R2010a):

System Solution Error: 1.28846e-07
Signal Recovery Error: 1.08647e-07
SPGL1 iter: 586  Exit Flag: 1

On my linux server (R2013a): Notice the poor recovery and higher iter count)

System Solution Error: 1.35595e-07
Signal Recovery Error: 2.93617e-03
SPGL1 iter: 948  Exit Flag: 1

On my friends linux laptop (R2014b): Again, poor recovery

System Solution Error: 1.39110e-07
Signal Recovery Error: 1.38157e-04
SPGL1 iter: 821 Exit Flag: 1

I do not know what is causing this issue but I thought I'd bring it to your attention

Small suggestion: skip invalid options rather than exit with error

As part of a bigger project, we're calling functions from SPGL1 and we'd like to mix parameters passed to our functions with the ones passed to spgSetParams(). Currently, if spgSetParams() encounters an unknown parameter name, it exits with an error. It's many times preferable to skip it with a warning (rather than silently) so that the user can backtrack on typos but also allow for extending SPGL1 within bigger projects.

I fixed it easily by changing:

  if isempty(j)                       % if no matches
     error(sprintf('Unrecognized parameter name ''%s''.', arg));

to:

  if isempty(j)                       % if no matches
     warning('Unrecognized parameter name ''%s''.', arg);
     i = i + 1;
     continue;

Other than that, fabulous work you did with SPGL1. Many thanks for it!

p.s. You don't need sprintf() inside error() or warning(). They both support formatting conversion characters like sprintf().

weighted L1 Norm

I want to know can i use this toolbox for problem with weighed l1 norm minimization. Thank you!!

Solve 0.5 * || A x - b ||^2 + \lambda || x ||_1

Hello,

Could you add a solver for L1 Regularized LS - 0.5 * || A x - b ||^2 + \lambda || x ||_1.
I know there for any Lambda there is a Tau in the Lasso Model s. t. the result is identical.

Yet still it is hard to figure it out and more importantly it would be nice to solve it directly.
It would be great to have it both for the Real and Complex domain.

Thank You.

P. S.
The strange thing regarding this problem is that it seems Proximal Subgradient and Sub Gradient Method are having real hard time when Lambda is very small (While Fixed Point Method will do it easily).

Incorrect relative error

This bit of code exits immediately, without any iterations:

clear;
rand('twister',0); randn('state',0);
m = 50; n = 128; k = 14;                   % No. of rows (m), columns (n), and nonzeros (k)
[A,Rtmp] = qr(randn(n,m),0);               % Random encoding matrix with orthogonal rows
A  = A';                                   % ... A is m-by-n
p  = randperm(n); p = p(1:k);              % Location of k nonzeros in x
x0 = zeros(n,1); x0(p) = randn(k,1);      % The k-sparse solution
x0 = x0.*1e-8;   % <--- this is what causes difficulty.
b  = A*x0;  

opts = spgSetParms('verbosity',1);         % Turn off the SPGL1 log output
x = spg_bp(A, b, opts);

The difficulty is that the relative error rError is defined as

rError=||r||/max(||r||,1)

but it should be correctly defined as

rError=||r||/max(||b||,1)

This error was reported by Justin Winokur Justin Winokur ([email protected]).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.