l1约束的最小二乘学习

1Constrained Least Squares
In sparse learning, 1 constrained LS, also known as Lasso Regression, is a common learning method:

minθJLS(θ)s.t.θ1R
where
θ1=j=1b|θj|

Generally speaking, the solution of an 1 constrained LS is located on the axis, that is to say, there are several parameters θj equal to zero (sparse).
Then how to solve it? Given the indifferentiable property of the absolute value at the origin, solving an 1 constrained LS is not so easy as solving the 2 constrained one. However, we can still apply Lagrange multiplier.
minθJ(θ),J(θ)=JLS(θ)+λθ1

Note that
|θj|θ2j2cj+cj2,cj>0
i.e. we can optimize the upper-bound of J(θ). By iteration, we take the current solution θ~j0 as cj so as to formulate the upper bound constraint:
|θj|θ2j2|θ~j|+|θ~j|2
If θ~j=0, we should take θj=0. When we use general inverse, the inequality above can be referred as:
|θj||θ~j|2θ2j+|θ~j|2

Therefore, we can get the following 2 regularized constrained LS problem formulation:
θ^=argminθJ~(θ),J~(θ)=JLS(θ)+λ2θTΘ~θ+C

where Θ~=|θ~1||θ~b| and C=bj=1|θ~j|/2 are independent of θ.

Take the parameterized linear model for example

fθ(x)=θTϕ(x)

Then, by the use of Lagrange multiplier, we can get
θ^=(ΦTΦ+λΘ~)1Φy

Renew the estimation θ~ as θ~=θ^, go back to calculate the new θ^ until θ^ comes to the required precision.

For simplicity, the whole algorithm goes as follows:

  1. Initialize θ0 and i=1.
  2. Calculate Θi using θi1.
  3. Estimate θi using Θi.
  4. i=i+1, go back to step 2.

An Example:

n=50; N=1000;
x=linspace(-3,3,n)'; X=linspace(-3,3,N)';
pix=pi*x;
y=sin(pix)./(pix)+0.1*x+0.2*rand(n,1);

hh=2*0.3^2; l=0.1; t0=randn(n,1); x2=x.^2;
k=exp(-(repmat(x2,1,n)+repmat(x2',n,1)-2*(x*x'))/hh);
k2=k^2; ky=k*y;
for o=1:1000
    t=(k2+l*pinv(diag(abs(t0))))\ky;
    if norm(t-t0)<0.001, break, end
    t0=t;
end
K=exp(-(repmat(X.^2,1,n)+repmat(x2',N,1)-2*X*x')/hh);
F=K*t;

figure(1); clf; hold on; axis([-2.8,2.8,-1,1.5]);
plot(X,F,'g-'); plot(x,y,'bp');

这里写图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值