LASSO with additional non-linear constraint
2 次查看(过去 30 天)
显示 更早的评论
Hi everyone,
I am really stacked.
I try to find optimal beta coefficients using LASSO technique, but with additional constraints. The problem looks like this.

subject to

Basically, I want to compute beta coefficients using lasso with constraint to be less than or equal to their sum of absolute value differences between them and other coefficients (because there are absolute values in non-linear constraint, I redefined constraints to appropriate form).
beta_b -> I want to compute
beta_a -> I previously computed (there should be parameters for the constraint function).
x -> numeric vector (n x 1)
X -> numeric matrix (n x m)
The lower index L means lagged, we need not consider it.
I tried to use fmincon solver, but I am stacked how should it look like.
I have this objective function
%%Objective function
function f = objfun(x, Y, M, lamb)
f = ((x*M - Y)^2 + lamb*abs(x));
end
And nonlinear constraints can look like this
function [c, ceq] = nonlcon(x, eps, p, betas_ref)
%%Inequality constraints
c(1) = x - betas_ref - (eps / p);
c(2) = betas_ref - x - (eps / p);
%%Equality constraints
ceq = [];
end
But the objective function need to be LASSO, so I do not know how can I put LASSO into this problem.
Please, can anybody help me with this problem?
0 个评论
回答(1 个)
Alan Weiss
2017-2-13
For fmincon, or indeed any Optimization Toolbox™ solver, you need to put all of your control variables in one vector, typically called x. I cannot tell from your formulation which are your control variables. You say that you want to compute the beta_b, but I do not see beta_b in your equations. I cannot tell if your x and X are data or are control variables.
In any case, once you figure out which are your control variables, put them all in one vector. Then you can extract them in your objective function, something like this. If one control variable is y = an n-by-m matrix, and another is b = a length t vector, then
x = [y(:);b(:)]
and x is a nm + t length vector. Inside your objective function you would write something like
function fun = myobj(x,n,m)
y = x(1:n*m);
b = x(n*m+1:end);
y = reshape(y,n,m);
% more commands here
Then you would pass
fun = @(x)myobj(x,n,m)
as the objective function, using a method for passing extra parameters, the parameters n and m in this case, but you probably want to pass more parameters than that.
All that said, I don't know how well fmincon would do at finding an optimum for Lasso. You see, Lasso is an L^1 minimization, which is not smooth.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
2 个评论
Alan Weiss
2017-2-21
You have so many misconceptions that it is hard to know where to begin.
You say you want your objective function to be a vector. You cannot have a vector-valued objective function in a minimization. Think about it, what should be minimized, the first component of the vector, the second, what? If you want to minimize the norm of the objective function vector, then you want to minimize that scalar value, so that is what you should specify as the objective function. In other words, if you want to minimize a vector-valued objective function, then you have not thought enough about what your problem is.
For another topic: control variables are the variables that can be adjusted to try to find an optimum. If you don't know which variables are the control variables, then you have no business trying to write an objective function. You have to figure that out first, before asking for any more help. As another way to think about it, you want to find some values that optimize something. Those values are your control variables, and the something is your objective function.
When you have figured out your control variables and scalar objective function, we can discuss things further.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!