l1约束的最小二乘学习

简介: ℓ1\ell_{1}Constrained Least Squares In sparse learning, ℓ1\ell_{1} constrained LS, also known as Lasso Regression, is a common learning method: minθJLS(θ)s.t.∥θ∥1≤R\min_{\theta} J_{LS}(\

1 Constrained 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');

这里写图片描述

相关文章
|
8月前
|
算法
MATLAB最小二乘法:线性最小二乘、加权线性最小二乘、稳健最小二乘、非线性最小二乘与剔除异常值效果比较
MATLAB最小二乘法:线性最小二乘、加权线性最小二乘、稳健最小二乘、非线性最小二乘与剔除异常值效果比较
|
机器学习/深度学习 决策智能
约束最优化方法 (四) 乘子法
约束最优化方法 (四) 乘子法
246 0
|
机器学习/深度学习
等约束二次规划中的特征分解研究(Matlab代码实现)
等约束二次规划中的特征分解研究(Matlab代码实现)
|
算法 决策智能
通用的改进遗传算法求解带约束的优化问题(MATLAB代码)
通用的改进遗传算法求解带约束的优化问题(MATLAB代码)
688 0
|
存储 算法
PDE优化|逆问题中偏微分方程约束优化的惩罚方法(Matlab代码实现)
PDE优化|逆问题中偏微分方程约束优化的惩罚方法(Matlab代码实现)
231 0
|
机器学习/深度学习 人工智能
【机器学习】SVM中的约束优化问题证明
【机器学习】SVM中的约束优化问题证明
155 0
【机器学习】SVM中的约束优化问题证明
|
机器学习/深度学习 关系型数据库
约束优化问题|机器学习推导系列(六)
约束优化问题|机器学习推导系列(六)
394 0
约束优化问题|机器学习推导系列(六)
|
机器学习/深度学习 存储 算法
非凸优化之非约束优化
非凸优化之非约束优化
403 0
|
机器学习/深度学习