Can Matlab do L1 minimization?

Hi, I'm trying to implement face recognition algorithm based on sparse representation. It has to do L1 minimization for optimization.
I am using linprog function for L1 minimization, but i'm not sure if matlab actually can solve this or it just gives an approximate solution.
I'm trying to find solution after L1 minimization of x using the constraint Aeq * x = y. lb is the lower bound (set to be zeros)
x1 = linprog(f,[],[],Aeq,y,lb,[],[],[]);
This is actually giving me good results. But I just want to confirm if this is the actual L1 minimization solution or just an approximate solution.

 Accepted Answer

Richard Brown
Richard Brown on 30 Apr 2012
Assming f is all ones, and you're wanting to minimise the 1-norm of x, then your code will be doing what you wish

5 Comments

Thanks, Just using my original A matrix does not do the optimization well.
I looked at the code from "Robust Face Recognition via Sparse Representation - Implementation" (http://www.mathworks.com/matlabcentral/fileexchange/30893-robust-face-recognition-via-sparse-representation-implementation) .
He is creating another matrix
Aeq = [A -A],
and doing the optimization (doubling the size of other vectors as necessary). Later the final solution x= x1(1:org_size) - x1(org_size+1, twice_org_size).
Doing this does the optimization well. Why so?
On the code you just found, it's solving a different problem. In that code, the variable x is unconstrained (not restricted to be positive). Splitting it into two components, both of which are constrained to be positive, is a standard trick for casting a problem into standard form. You can't just remove the lower bound on your form, because then your objective will be defined incorrectly.
Thanks.
One more question, in sparse representation paper it says that if we expect errors, we can model our optimization as
y = Aeq * x + e
instead of
y = Aeq * x
The vector e will have the errors after x has converged to its best state. Can I use matlab for this implementation?
Yes, but you need to set up the problem a bit differently. Here you want to minimise ||A*x - y|| + lambda ||x||, where the second term is called a "regularization" term, with a parameter lambda that you might need to experiment with

Sign in to comment.

More Answers (1)

It will do its best to minimise the residual errors. If a real solution exists, it will converge on that. Yes, it's 'approximate' in the sense that there is a termination tolerance value to control how many decimal places you care about. If you want it more exact, set the TolFun option using optimset, and pass your options into linprog.
opts = optimset('linprog');
set( opts, 'TolFun', 1e-12 );
x1 = linprog( f, [], [], Aeq, y, lb, [], [], opts );

2 Comments

Thanks for letting me know that we can set the tolerance.
Hello, I am also working on the same program. Can you tell me how can I find the recognition rate?

Sign in to comment.

Asked:

Rex
on 30 Apr 2012

Commented:

on 18 Mar 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!