- Source: Lasso (statistics)
In statistics and machine learning, lasso (least absolute shrinkage and selection operator; also Lasso or LASSO) is a regression analysis method that performs both variable selection and regularization in order to enhance the prediction accuracy and interpretability of the resulting statistical model. The lasso method assumes that the coefficients of the linear model are sparse, meaning that few of them are non-zero. It was originally introduced in geophysics, and later by Robert Tibshirani, who coined the term.
Lasso was originally formulated for linear regression models. This simple case reveals a substantial amount about the estimator. These include its relationship to ridge regression and best subset selection and the connections between lasso coefficient estimates and so-called soft thresholding. It also reveals that (like standard linear regression) the coefficient estimates do not need to be unique if covariates are collinear.
Though originally defined for linear regression, lasso regularization is easily extended to other statistical models including generalized linear models, generalized estimating equations, proportional hazards models, and M-estimators. Lasso's ability to perform subset selection relies on the form of the constraint and has a variety of interpretations including in terms of geometry, Bayesian statistics and convex analysis.
The LASSO is closely related to basis pursuit denoising.
History
Lasso was introduced in order to improve the prediction accuracy and interpretability of regression models. It selects a reduced set of the known covariates for use in a model.
Lasso was developed independently in geophysics literature in 1986, based on prior work that used the
ℓ
1
{\displaystyle \ell ^{1}}
penalty for both fitting and penalization of the coefficients. Statistician Robert Tibshirani independently rediscovered and popularized it in 1996, based on Breiman's nonnegative garrote.
Prior to lasso, the most widely used method for choosing covariates was stepwise selection. That approach only improves prediction accuracy in certain cases, such as when only a few covariates have a strong relationship with the outcome. However, in other cases, it can increase prediction error.
At the time, ridge regression was the most popular technique for improving prediction accuracy. Ridge regression improves prediction error by shrinking the sum of the squares of the regression coefficients to be less than a fixed value in order to reduce overfitting, but it does not perform covariate selection and therefore does not help to make the model more interpretable.
Lasso achieves both of these goals by forcing the sum of the absolute value of the regression coefficients to be less than a fixed value, which forces certain coefficients to zero, excluding them from impacting prediction. This idea is similar to ridge regression, which also shrinks the size of the coefficients; however, ridge regression does not set coefficients to zero (and, thus, does not perform variable selection).
Basic form
= Least squares
=Consider a sample consisting of N cases, each of which consists of p covariates and a single outcome. Let
y
i
{\displaystyle y_{i}}
be the outcome and
x
i
:=
(
x
1
,
x
2
,
…
,
x
p
)
i
T
{\displaystyle x_{i}:=(x_{1},x_{2},\ldots ,x_{p})_{i}^{T}}
be the covariate vector for the i th case. Then the objective of lasso is to solve
min
β
0
,
β
{
∑
i
=
1
N
(
y
i
−
β
0
−
x
i
T
β
)
2
}
subject to
∑
j
=
1
p
|
β
j
|
≤
t
.
{\displaystyle \min _{\beta _{0},\beta }{\biggl \{}\sum _{i=1}^{N}{\bigl (}y_{i}-\beta _{0}-x_{i}^{T}\beta {\bigr )}^{2}{\biggr \}}{\text{ subject to }}\sum _{j=1}^{p}|\beta _{j}|\leq t.}
Here
β
0
{\displaystyle \beta _{0}}
is the constant coefficient,
β
:=
(
β
1
,
β
2
,
…
,
β
p
)
{\displaystyle \beta :=(\beta _{1},\beta _{2},\ldots ,\beta _{p})}
is the coefficient vector, and
t
{\displaystyle t}
is a prespecified free parameter that determines the degree of regularization.
Letting
X
{\displaystyle X}
be the covariate matrix, so that
X
i
j
=
(
x
i
)
j
{\displaystyle X_{ij}=(x_{i})_{j}}
and
x
i
T
{\displaystyle x_{i}^{T}}
is the i th row of
X
{\displaystyle X}
, the expression can be written more compactly as
min
β
0
,
β
{
‖
y
−
β
0
−
X
β
‖
2
2
}
subject to
‖
β
‖
1
≤
t
,
{\displaystyle \min _{\beta _{0},\beta }\left\{\left\|y-\beta _{0}-X\beta \right\|_{2}^{2}\right\}{\text{ subject to }}\|\beta \|_{1}\leq t,}
where
‖
u
‖
p
=
(
∑
i
=
1
N
|
u
i
|
p
)
1
/
p
{\displaystyle \|u\|_{p}={\biggl (}\sum _{i=1}^{N}|u_{i}|^{p}{\biggr )}^{1/p}}
is the standard
ℓ
p
{\displaystyle \ell ^{p}}
norm.
Denoting the scalar mean of the data points
x
i
{\displaystyle x_{i}}
by
x
¯
{\displaystyle {\bar {x}}}
and the mean of the response variables
y
i
{\displaystyle y_{i}}
by
y
¯
{\displaystyle {\bar {y}}}
, the resulting estimate for
β
0
{\displaystyle \beta _{0}}
is
β
^
0
=
y
¯
−
x
¯
T
β
{\displaystyle {\hat {\beta }}_{0}={\bar {y}}-{\bar {x}}^{T}\beta }
, so that
y
i
−
β
^
0
−
x
i
T
β
=
y
i
−
(
y
¯
−
x
¯
T
β
)
−
x
i
T
β
=
(
y
i
−
y
¯
)
−
(
x
i
−
x
¯
)
T
β
,
{\displaystyle y_{i}-{\hat {\beta }}_{0}-x_{i}^{T}\beta =y_{i}-({\bar {y}}-{\bar {x}}^{T}\beta )-x_{i}^{T}\beta =(y_{i}-{\bar {y}})-(x_{i}-{\bar {x}})^{T}\beta ,}
and therefore it is standard to work with variables that have been made zero-mean. Additionally, the covariates are typically standardized
(
∑
i
=
1
N
x
i
2
=
1
)
{\textstyle {\bigl (}\sum _{i=1}^{N}x_{i}^{2}=1{\bigr )}}
so that the solution does not depend on the measurement scale.
It can be helpful to rewrite
min
β
∈
R
p
{
1
N
‖
y
−
X
β
‖
2
2
}
subject to
‖
β
‖
1
≤
t
.
{\displaystyle \min _{\beta \in \mathbb {R} ^{p}}\left\{{\frac {1}{N}}\left\|y-X\beta \right\|_{2}^{2}\right\}{\text{ subject to }}\|\beta \|_{1}\leq t.}
in the so-called Lagrangian form
min
β
∈
R
p
{
1
N
‖
y
−
X
β
‖
2
2
+
λ
‖
β
‖
1
}
{\displaystyle \min _{\beta \in \mathbb {R} ^{p}}\left\{{\frac {1}{N}}\left\|y-X\beta \right\|_{2}^{2}+\lambda \|\beta \|_{1}\right\}}
where the exact relationship between
t
{\displaystyle t}
and
λ
{\displaystyle \lambda }
is data dependent.
= Orthonormal covariates
=Some basic properties of the lasso estimator can now be considered.
Assuming first that the covariates are orthonormal so that
x
i
T
x
j
=
δ
i
j
{\displaystyle x_{i}^{T}x_{j}=\delta _{ij}}
, where
δ
i
j
{\displaystyle \delta _{ij}}
is the Kronecker delta, or, equivalently,
X
T
X
=
I
{\displaystyle X^{T}X=I}
, then using subgradient methods it can be shown that
β
^
j
=
S
N
λ
(
β
^
j
OLS
)
=
β
^
j
OLS
max
(
0
,
1
−
N
λ
|
β
^
j
OLS
|
)
where
β
^
j
OLS
=
(
X
T
X
)
−
1
X
T
y
=
X
T
y
{\displaystyle {\begin{aligned}{\hat {\beta }}_{j}={}&S_{N\lambda }({\hat {\beta }}{}_{j}^{\!\;{\text{OLS}}})={\hat {\beta }}{}_{j}^{\!\;{\text{OLS}}}\max {\Biggl (}0,1-{\frac {N\lambda }{{\bigl |}{\hat {\beta }}{}_{j}^{\!\;{\text{OLS}}}{\bigr |}}}{\Biggr )}\\&{\text{ where }}{\hat {\beta }}{}_{j}^{\!\;{\text{OLS}}}=(X^{T}X)^{-1}X^{T}y=X^{T}y\end{aligned}}}
S
α
{\displaystyle S_{\alpha }}
is referred to as the soft thresholding operator, since it translates values towards zero (making them exactly zero if they are small enough) instead of setting smaller values to zero and leaving larger ones untouched as the hard thresholding operator, often denoted
H
α
{\displaystyle H_{\alpha }}
, would.
In ridge regression the objective is to minimize
min
β
∈
R
p
{
1
N
‖
y
−
X
β
‖
2
2
+
λ
‖
β
‖
2
2
}
{\displaystyle \min _{\beta \in \mathbb {R} ^{p}}\left\{{\frac {1}{N}}\|y-X\beta \|_{2}^{2}+\lambda \|\beta \|_{2}^{2}\right\}}
Using
X
T
X
=
I
{\displaystyle X^{T}X=I}
and the ridge regression formula:
β
^
=
(
(
X
T
X
)
+
N
λ
I
)
−
1
X
T
y
{\displaystyle {\hat {\beta }}=\left((X^{T}X)+N\lambda I\right)^{-1}X^{T}y}
, it yields:
β
^
j
=
(
1
+
N
λ
)
−
1
β
^
j
OLS
.
{\displaystyle {\hat {\beta }}_{j}=(1+N\lambda )^{-1}{\hat {\beta }}{}_{j}^{\!\;{\text{OLS}}}.}
Ridge regression shrinks all coefficients by a uniform factor of
(
1
+
N
λ
)
−
1
{\displaystyle (1+N\lambda )^{-1}}
and does not set any coefficients to zero.
It can also be compared to regression with best subset selection, in which the goal is to minimize
min
β
∈
R
p
{
1
N
‖
y
−
X
β
‖
2
2
+
λ
‖
β
‖
0
}
{\displaystyle \min _{\beta \in \mathbb {R} ^{p}}\left\{{\frac {1}{N}}\left\|y-X\beta \right\|_{2}^{2}+\lambda \|\beta \|_{0}\right\}}
where
‖
⋅
‖
0
{\displaystyle \|\cdot \|_{0}}
is the "
ℓ
0
{\displaystyle \ell ^{0}}
norm", which is defined as
‖
z
‖
=
m
{\displaystyle \|z\|=m}
if exactly m components of z are nonzero. In this case, it can be shown that
β
^
j
=
H
N
λ
(
β
^
j
OLS
)
=
β
^
j
OLS
I
(
|
β
^
j
OLS
|
≥
N
λ
)
{\displaystyle {\hat {\beta }}_{j}=H_{\sqrt {N\lambda }}\left({\hat {\beta }}{}_{j}^{\!\;{\text{OLS}}}\right)={\hat {\beta }}{}_{j}^{\!\;{\text{OLS}}}\mathrm {I} \left({\bigl |}{\hat {\beta }}{}_{j}^{\!\;{\text{OLS}}}{\bigr |}\geq {\sqrt {N\lambda }}\right)}
where
H
α
{\displaystyle H_{\alpha }}
is the so-called hard thresholding function and
I
{\displaystyle \mathrm {I} }
is an indicator function (it is 1 if its argument is true and 0 otherwise).
Therefore, the lasso estimates share features of both ridge and best subset selection regression since they both shrink the magnitude of all the coefficients, like ridge regression and set some of them to zero, as in the best subset selection case. Additionally, while ridge regression scales all of the coefficients by a constant factor, lasso instead translates the coefficients towards zero by a constant value and sets them to zero if they reach it.
= Correlated covariates
=In one special case two covariates, say j and k, are identical for each observation, so that
x
(
j
)
=
x
(
k
)
{\displaystyle x_{(j)}=x_{(k)}}
, where
x
(
j
)
,
i
=
x
(
k
)
,
i
{\displaystyle x_{(j),i}=x_{(k),i}}
. Then the values of
β
j
{\displaystyle \beta _{j}}
and
β
k
{\displaystyle \beta _{k}}
that minimize the lasso objective function are not uniquely determined. In fact, if some
β
^
{\displaystyle {\hat {\beta }}}
in which
β
^
j
β
^
k
≥
0
{\displaystyle {\hat {\beta }}_{j}{\hat {\beta }}_{k}\geq 0}
, then if
s
∈
[
0
,
1
]
{\displaystyle s\in [0,1]}
replacing
β
^
j
{\displaystyle {\hat {\beta }}_{j}}
by
s
(
β
^
j
+
β
^
k
)
{\displaystyle s({\hat {\beta }}_{j}+{\hat {\beta }}_{k})}
and
β
^
k
{\displaystyle {\hat {\beta }}_{k}}
by
(
1
−
s
)
(
β
^
j
+
β
^
k
)
{\displaystyle (1-s)({\hat {\beta }}_{j}+{\hat {\beta }}_{k})}
, while keeping all the other
β
^
i
{\displaystyle {\hat {\beta }}_{i}}
fixed, gives a new solution, so the lasso objective function then has a continuum of valid minimizers. Several variants of the lasso, including the Elastic net regularization, have been designed to address this shortcoming.
General form
Lasso regularization can be extended to other objective functions such as those for generalized linear models, generalized estimating equations, proportional hazards models, and M-estimators. Given the objective function
1
N
∑
i
=
1
N
f
(
x
i
,
y
i
,
α
,
β
)
{\displaystyle {\frac {1}{N}}\sum _{i=1}^{N}f(x_{i},y_{i},\alpha ,\beta )}
the lasso regularized version of the estimator s the solution to
min
α
,
β
1
N
∑
i
=
1
N
f
(
x
i
,
y
i
,
α
,
β
)
subject to
‖
β
‖
1
≤
t
{\displaystyle \min _{\alpha ,\beta }{\frac {1}{N}}\sum _{i=1}^{N}f(x_{i},y_{i},\alpha ,\beta ){\text{ subject to }}\|\beta \|_{1}\leq t}
where only
β
{\displaystyle \beta }
is penalized while
α
{\displaystyle \alpha }
is free to take any allowed value, just as
β
0
{\displaystyle \beta _{0}}
was not penalized in the basic case.
Interpretations
= Geometric interpretation
=Lasso can set coefficients to zero, while the superficially similar ridge regression cannot. This is due to the difference in the shape of their constraint boundaries. Both lasso and ridge regression can be interpreted as minimizing the same objective function
min
β
0
,
β
{
1
N
‖
y
−
β
0
−
X
β
‖
2
2
}
{\displaystyle \min _{\beta _{0},\beta }\left\{{\frac {1}{N}}\left\|y-\beta _{0}-X\beta \right\|_{2}^{2}\right\}}
but with respect to different constraints:
‖
β
‖
1
≤
t
{\displaystyle \|\beta \|_{1}\leq t}
for lasso and
‖
β
‖
2
2
≤
t
{\displaystyle \|\beta \|_{2}^{2}\leq t}
for ridge. The figure shows that the constraint region defined by the
ℓ
1
{\displaystyle \ell ^{1}}
norm is a square rotated so that its corners lie on the axes (in general a cross-polytope), while the region defined by the
ℓ
2
{\displaystyle \ell ^{2}}
norm is a circle (in general an n-sphere), which is rotationally invariant and, therefore, has no corners. As seen in the figure, a convex object that lies tangent to the boundary, such as the line shown, is likely to encounter a corner (or a higher-dimensional equivalent) of a hypercube, for which some components of
β
{\displaystyle \beta }
are identically zero, while in the case of an n-sphere, the points on the boundary for which some of the components of
β
{\displaystyle \beta }
are zero are not distinguished from the others and the convex object is no more likely to contact a point at which some components of
β
{\displaystyle \beta }
are zero than one for which none of them are.
= Making λ easier to interpret with an accuracy-simplicity tradeoff
=The lasso can be rescaled so that it becomes easy to anticipate and influence the degree of shrinkage associated with a given value of
λ
{\displaystyle \lambda }
. It is assumed that
X
{\displaystyle X}
is standardized with z-scores and that
y
{\displaystyle y}
is centered (zero mean). Let
β
0
{\displaystyle \beta _{0}}
represent the hypothesized regression coefficients and let
b
OLS
{\displaystyle b_{\text{OLS}}}
refer to the data-optimized ordinary least squares solutions. We can then define the Lagrangian as a tradeoff between the in-sample accuracy of the data-optimized solutions and the simplicity of sticking to the hypothesized values. This results in
min
β
∈
R
p
{
(
y
−
X
β
)
′
(
y
−
X
β
)
(
y
−
X
β
0
)
′
(
y
−
X
β
0
)
+
2
λ
∑
i
=
1
p
|
β
i
−
β
0
,
i
|
q
i
}
{\displaystyle \min _{\beta \in \mathbb {R} ^{p}}\left\{{\frac {(y-X\beta )'(y-X\beta )}{(y-X\beta _{0})'(y-X\beta _{0})}}+2\lambda \sum _{i=1}^{p}{\frac {|\beta _{i}-\beta _{0,i}|}{q_{i}}}\right\}}
where
q
i
{\displaystyle q_{i}}
is specified below and the "prime" symbol stands for transpose. The first fraction represents relative accuracy, the second fraction relative simplicity, and
λ
{\displaystyle \lambda }
balances between the two.
Given a single regressor, relative simplicity can be defined by specifying
q
i
{\displaystyle q_{i}}
as
|
b
OLS
−
β
0
|
{\displaystyle |b_{\text{OLS}}-\beta _{0}|}
, which is the maximum amount of deviation from
β
0
{\displaystyle \beta _{0}}
when
λ
=
0
{\displaystyle \lambda =0}
. Assuming that
β
0
=
0
{\displaystyle \beta _{0}=0}
, the solution path can be defined in terms of
R
2
{\displaystyle R^{2}}
:
b
ℓ
1
=
{
(
1
−
λ
/
R
2
)
b
OLS
if
λ
≤
R
2
,
0
if
λ
>
R
2
.
{\displaystyle b_{\ell _{1}}={\begin{cases}(1-\lambda /R^{2})b_{\text{OLS}}&{\mbox{if }}\lambda \leq R^{2},\\0&{\mbox{if }}\lambda >R^{2}.\end{cases}}}
If
λ
=
0
{\displaystyle \lambda =0}
, the ordinary least squares solution (OLS) is used. The hypothesized value of
β
0
=
0
{\displaystyle \beta _{0}=0}
is selected if
λ
{\displaystyle \lambda }
is bigger than
R
2
{\displaystyle R^{2}}
. Furthermore, if
R
2
=
1
{\displaystyle R^{2}=1}
, then
λ
{\displaystyle \lambda }
represents the proportional influence of
β
0
=
0
{\displaystyle \beta _{0}=0}
. In other words,
λ
×
100
%
{\displaystyle \lambda \times 100\%}
measures in percentage terms the minimal amount of influence of the hypothesized value relative to the data-optimized OLS solution.
If an
ℓ
2
{\displaystyle \ell _{2}}
-norm is used to penalize deviations from zero given a single regressor, the solution path is given by
b
ℓ
2
=
(
1
+
λ
R
2
(
1
−
λ
)
)
−
1
b
OLS
.
{\displaystyle b_{\ell _{2}}=\left(1+{\frac {\lambda }{R^{2}(1-\lambda )}}\right)^{-1}b_{\text{OLS}}.}
Like
b
ℓ
1
{\displaystyle b_{\ell _{1}}}
,
b
ℓ
2
{\displaystyle b_{\ell _{2}}}
moves in the direction of the point
(
λ
=
R
2
,
b
=
0
)
{\displaystyle (\lambda =R^{2},b=0)}
when
λ
{\displaystyle \lambda }
is close to zero; but unlike
b
ℓ
1
{\displaystyle b_{\ell _{1}}}
, the influence of
R
2
{\displaystyle R^{2}}
diminishes in
b
ℓ
2
{\displaystyle b_{\ell _{2}}}
if
λ
{\displaystyle \lambda }
increases (see figure). Given multiple regressors, the moment that a parameter is activated (i.e. allowed to deviate from
β
0
{\displaystyle \beta _{0}}
) is also determined by a regressor's contribution to
R
2
{\displaystyle R^{2}}
accuracy. First,
R
2
=
1
−
(
y
−
X
b
)
′
(
y
−
X
b
)
(
y
−
X
β
0
)
′
(
y
−
X
β
0
)
.
{\displaystyle R^{2}=1-{\frac {(y-Xb)'(y-Xb)}{(y-X\beta _{0})'(y-X\beta _{0})}}.}
An
R
2
{\displaystyle R^{2}}
of 75% means that in-sample accuracy improves by 75% if the unrestricted OLS solutions are used instead of the hypothesized
β
0
{\displaystyle \beta _{0}}
values. The individual contribution of deviating from each hypothesis can be computed with the
p
{\displaystyle p}
x
p
{\displaystyle p}
matrix
R
⊗
=
(
X
′
y
~
0
)
(
X
′
y
~
0
)
′
(
X
′
X
)
−
1
(
y
~
0
′
y
~
0
)
−
1
,
{\displaystyle R^{\otimes }=(X'{\tilde {y}}_{0})(X'{\tilde {y}}_{0})'(X'X)^{-1}({\tilde {y}}_{0}'{\tilde {y}}_{0})^{-1},}
where
y
~
0
=
y
−
X
β
0
{\displaystyle {\tilde {y}}_{0}=y-X\beta _{0}}
. If
b
=
b
OLS
{\displaystyle b=b_{\text{OLS}}}
when
R
2
{\displaystyle R^{2}}
is computed, then the diagonal elements of
R
⊗
{\displaystyle R^{\otimes }}
sum to
R
2
{\displaystyle R^{2}}
. The diagonal
R
⊗
{\displaystyle R^{\otimes }}
values may be smaller than 0 or, less often, larger than 1. If regressors are uncorrelated, then the
i
t
h
{\displaystyle i^{th}}
diagonal element of
R
⊗
{\displaystyle R^{\otimes }}
simply corresponds to the
r
2
{\displaystyle r^{2}}
value between
x
i
{\displaystyle x_{i}}
and
y
{\displaystyle y}
.
A rescaled version of the adaptive lasso of can be obtained by setting
q
adaptive lasso
,
i
=
|
b
OLS
,
i
−
β
0
,
i
|
{\displaystyle q_{{\mbox{adaptive lasso}},i}=|b_{{\text{OLS}},i}-\beta _{0,i}|}
. If regressors are uncorrelated, the moment that the
i
t
h
{\displaystyle i^{th}}
parameter is activated is given by the
i
t
h
{\displaystyle i^{th}}
diagonal element of
R
⊗
{\displaystyle R^{\otimes }}
. Assuming for convenience that
β
0
{\displaystyle \beta _{0}}
is a vector of zeros,
b
i
=
{
(
1
−
λ
/
R
i
i
⊗
)
b
OLS
,
i
if
λ
≤
R
i
i
⊗
,
0
if
λ
>
R
i
i
⊗
.
{\displaystyle b_{i}={\begin{cases}(1-\lambda /R_{ii}^{\otimes })b_{{\text{OLS}},i}&{\text{if }}\lambda \leq R_{ii}^{\otimes },\\0&{\text{if }}\lambda >R_{ii}^{\otimes }.\end{cases}}}
That is, if regressors are uncorrelated,
λ
{\displaystyle \lambda }
again specifies the minimal influence of
β
0
{\displaystyle \beta _{0}}
. Even when regressors are correlated, the first time that a regression parameter is activated occurs when
λ
{\displaystyle \lambda }
is equal to the highest diagonal element of
R
⊗
{\displaystyle R^{\otimes }}
.
These results can be compared to a rescaled version of the lasso by defining
q
lasso
,
i
=
1
p
∑
l
|
b
OLS
,
l
−
β
0
,
l
|
{\displaystyle q_{{\mbox{lasso}},i}={\frac {1}{p}}\sum _{l}|b_{{\text{OLS}},l}-\beta _{0,l}|}
, which is the average absolute deviation of
b
OLS
{\displaystyle b_{\text{OLS}}}
from
β
0
{\displaystyle \beta _{0}}
. Assuming that regressors are uncorrelated, then the moment of activation of the
i
t
h
{\displaystyle i^{th}}
regressor is given by
λ
~
lasso
,
i
=
1
p
R
i
⊗
∑
l
=
1
p
R
l
⊗
.
{\displaystyle {\tilde {\lambda }}_{{\text{lasso}},i}={\frac {1}{p}}{\sqrt {R_{i}^{\otimes }}}\sum _{l=1}^{p}{\sqrt {R_{l}^{\otimes }}}.}
For
p
=
1
{\displaystyle p=1}
, the moment of activation is again given by
λ
~
lasso
,
i
=
R
2
{\displaystyle {\tilde {\lambda }}_{{\text{lasso}},i}=R^{2}}
. If
β
0
{\displaystyle \beta _{0}}
is a vector of zeros and a subset of
p
B
{\displaystyle p_{B}}
relevant parameters are equally responsible for a perfect fit of
R
2
=
1
{\displaystyle R^{2}=1}
, then this subset is activated at a
λ
{\displaystyle \lambda }
value of
1
p
{\displaystyle {\frac {1}{p}}}
. The moment of activation of a relevant regressor then equals
1
p
1
p
B
p
B
1
p
B
=
1
p
{\displaystyle {\frac {1}{p}}{\frac {1}{\sqrt {p_{B}}}}p_{B}{\frac {1}{\sqrt {p_{B}}}}={\frac {1}{p}}}
. In other words, the inclusion of irrelevant regressors delays the moment that relevant regressors are activated by this rescaled lasso. The adaptive lasso and the lasso are special cases of a '1ASTc' estimator. The latter only groups parameters together if the absolute correlation among regressors is larger than a user-specified value.
= Bayesian interpretation
=Just as ridge regression can be interpreted as linear regression for which the coefficients have been assigned normal prior distributions, lasso can be interpreted as linear regression for which the coefficients have Laplace prior distributions. The Laplace distribution is sharply peaked at zero (its first derivative is discontinuous at zero) and it concentrates its probability mass closer to zero than does the normal distribution. This provides an alternative explanation of why lasso tends to set some coefficients to zero, while ridge regression does not.
= Convex relaxation interpretation
=Lasso can also be viewed as a convex relaxation of the best subset selection regression problem, which is to find the subset of
≤
k
{\displaystyle \leq k}
covariates that results in the smallest value of the objective function for some fixed
k
≤
n
{\displaystyle k\leq n}
, where n is the total number of covariates. The "
ℓ
0
{\displaystyle \ell ^{0}}
norm",
‖
⋅
‖
0
{\displaystyle \|\cdot \|_{0}}
, (the number of nonzero entries of a vector), is the limiting case of "
ℓ
p
{\displaystyle \ell ^{p}}
norms", of the form
‖
x
‖
p
=
(
∑
i
=
1
n
|
x
j
|
p
)
1
/
p
{\displaystyle \textstyle \|x\|_{p}=\left(\sum _{i=1}^{n}|x_{j}|^{p}\right)^{1/p}}
(where the quotation marks signify that these are not really norms for
p
<
1
{\displaystyle p<1}
since
‖
⋅
‖
p
{\displaystyle \|\cdot \|_{p}}
is not convex for
p
<
1
{\displaystyle p<1}
, so the triangle inequality does not hold). Therefore, since p = 1 is the smallest value for which the "
ℓ
p
{\displaystyle \ell ^{p}}
norm" is convex (and therefore actually a norm), lasso is, in some sense, the best convex approximation to the best subset selection problem, since the region defined by
‖
x
‖
1
≤
t
{\displaystyle \|x\|_{1}\leq t}
is the convex hull of the region defined by
‖
x
‖
p
≤
t
{\displaystyle \|x\|_{p}\leq t}
for
p
<
1
{\displaystyle p<1}
.
Generalizations
Lasso variants have been created in order to remedy limitations of the original technique and to make the method more useful for particular problems. Almost all of these focus on respecting or exploiting dependencies among the covariates.
Elastic net regularization adds an additional ridge regression-like penalty that improves performance when the number of predictors is larger than the sample size, allows the method to select strongly correlated variables together, and improves overall prediction accuracy.
Group lasso allows groups of related covariates to be selected as a single unit, which can be useful in settings where it does not make sense to include some covariates without others. Further extensions of group lasso perform variable selection within individual groups (sparse group lasso) and allow overlap between groups (overlap group lasso).
Fused lasso can account for the spatial or temporal characteristics of a problem, resulting in estimates that better match system structure. Lasso-regularized models can be fit using techniques including subgradient methods, least-angle regression (LARS), and proximal gradient methods. Determining the optimal value for the regularization parameter is an important part of ensuring that the model performs well; it is typically chosen using cross-validation.
= Elastic net
=In 2005, Zou and Hastie introduced the elastic net. When p > n (the number of covariates is greater than the sample size) lasso can select only n covariates (even when more are associated with the outcome) and it tends to select one covariate from any set of highly correlated covariates. Additionally, even when n > p, ridge regression tends to perform better given strongly correlated covariates.
The elastic net extends lasso by adding an additional
ℓ
2
{\displaystyle \ell ^{2}}
penalty term giving
min
β
∈
R
p
{
‖
y
−
X
β
‖
2
2
+
λ
1
‖
β
‖
1
+
λ
2
‖
β
‖
2
2
}
,
{\displaystyle \min _{\beta \in \mathbb {R} ^{p}}\left\{\left\|y-X\beta \right\|_{2}^{2}+\lambda _{1}\|\beta \|_{1}+\lambda _{2}\|\beta \|_{2}^{2}\right\},}
which is equivalent to solving
min
β
0
,
β
{
‖
y
−
β
0
−
X
β
‖
2
2
}
subject to
(
1
−
α
)
‖
β
‖
1
+
α
‖
β
‖
2
2
≤
t
,
where
α
=
λ
2
λ
1
+
λ
2
.
{\displaystyle {\begin{aligned}\min _{\beta _{0},\beta }\left\{\left\|y-\beta _{0}-X\beta \right\|_{2}^{2}\right\}&{\text{ subject to }}(1-\alpha )\|\beta \|_{1}+\alpha \|\beta \|_{2}^{2}\leq t,\\&{\text{ where }}\alpha ={\frac {\lambda _{2}}{\lambda _{1}+\lambda _{2}}}.\end{aligned}}}
This problem can be written in a simple lasso form
min
β
∗
∈
R
p
{
‖
y
∗
−
X
∗
β
∗
‖
2
2
+
λ
∗
‖
β
∗
‖
1
}
{\displaystyle \min _{\beta ^{*}\in \mathbb {R} ^{p}}\left\{\left\|y^{*}-X^{*}\beta ^{*}\right\|_{2}^{2}+\lambda ^{*}\|\beta ^{*}\|_{1}\right\}}
letting
X
(
n
+
p
)
×
p
∗
=
(
1
+
λ
2
)
−
1
/
2
(
X
λ
2
1
/
2
I
p
×
p
)
,
{\displaystyle X_{(n+p)\times p}^{*}=(1+\lambda _{2})^{-1/2}{\binom {X}{\lambda _{2}^{1/2}I_{p\times p}}},}
y
(
n
+
p
)
∗
=
(
y
0
p
)
,
λ
∗
=
λ
1
1
+
λ
2
,
{\displaystyle y_{(n+p)}^{*}={\binom {y}{0^{p}}},\qquad \lambda ^{*}={\frac {\lambda _{1}}{\sqrt {1+\lambda _{2}}}},}
β
∗
=
1
+
λ
2
β
.
{\displaystyle \beta ^{*}={\sqrt {1+\lambda _{2}}}\beta .}
Then
β
^
=
β
^
∗
1
+
λ
2
{\displaystyle {\hat {\beta }}={\frac {{\hat {\beta }}^{*}}{\sqrt {1+\lambda _{2}}}}}
, which, when the covariates are orthogonal to each other, gives
β
^
j
=
β
^
j
∗
,
OLS
1
+
λ
2
max
(
0
,
1
−
λ
∗
|
β
^
j
∗
,
OLS
|
)
=
β
^
j
OLS
1
+
λ
2
max
(
0
,
1
−
λ
1
|
β
^
j
OLS
|
)
=
(
1
+
λ
2
)
−
1
β
^
j
lasso
.
{\displaystyle {\hat {\beta }}_{j}={\frac {{\hat {\beta }}{}_{j}^{\!\;*,{\text{OLS}}}}{\sqrt {1+\lambda _{2}}}}\max {\Biggl (}0,1-{\frac {\lambda ^{*}}{{\bigl |}{\hat {\beta }}{}_{j}^{\!\;*,{\text{OLS}}}{\bigr |}}}{\Biggr )}={\frac {{\hat {\beta }}{}_{j}^{\!\;{\text{OLS}}}}{1+\lambda _{2}}}\max {\Biggl (}0,1-{\frac {\lambda _{1}}{{\bigl |}{\hat {\beta }}{}_{j}^{\!\;{\text{OLS}}}{\bigr |}}}{\Biggr )}=(1+\lambda _{2})^{-1}{\hat {\beta }}{}_{j}^{\text{lasso}}.}
So the result of the elastic net penalty is a combination of the effects of the lasso and ridge penalties.
Returning to the general case, the fact that the penalty function is now strictly convex means that if
x
(
j
)
=
x
(
k
)
{\displaystyle x_{(j)}=x_{(k)}}
,
β
^
j
=
β
^
k
{\displaystyle {\hat {\beta }}_{j}={\hat {\beta }}_{k}}
, which is a change from lasso. In general, if
β
^
j
β
k
^
>
0
{\displaystyle {\hat {\beta }}_{j}{\hat {\beta _{k}}}>0}
|
β
^
j
−
β
k
^
|
‖
y
‖
≤
λ
2
−
1
2
(
1
−
ρ
j
k
)
,
where
ρ
=
X
t
X
,
{\displaystyle {\frac {|{\hat {\beta }}_{j}-{\hat {\beta _{k}}}|}{\|y\|}}\leq \lambda _{2}^{-1}{\sqrt {2(1-\rho _{jk})}},{\text{ where }}\rho =X^{t}X,}
is the sample correlation matrix because the
x
{\displaystyle x}
's are normalized.
Therefore, highly correlated covariates tend to have similar regression coefficients, with the degree of similarity depending on both
‖
y
‖
1
{\displaystyle \|y\|_{1}}
and
λ
2
{\displaystyle \lambda _{2}}
, which is different from lasso. This phenomenon, in which strongly correlated covariates have similar regression coefficients, is referred to as the grouping effect. Grouping is desirable since, in applications such as tying genes to a disease, finding all the associated covariates is preferable, rather than selecting one from each set of correlated covariates, as lasso often does. In addition, selecting only one from each group typically results in increased prediction error, since the model is less robust (which is why ridge regression often outperforms lasso).
= Group lasso
=In 2006, Yuan and Lin introduced the group lasso to allow predefined groups of covariates to jointly be selected into or out of a model. This is useful in many settings, perhaps most obviously when a categorical variable is coded as a collection of binary covariates. In this case, group lasso can ensure that all the variables encoding the categorical covariate are included or excluded together. Another setting in which grouping is natural is in biological studies. Since genes and proteins often lie in known pathways, which pathways are related to an outcome may be more significant than whether individual genes are. The objective function for the group lasso is a natural generalization of the standard lasso objective
min
β
∈
R
p
{
‖
y
−
∑
j
=
1
J
X
j
β
j
‖
2
2
+
λ
∑
j
=
1
J
‖
β
j
‖
K
j
}
,
‖
z
‖
K
j
=
(
z
t
K
j
z
)
1
/
2
{\displaystyle \min _{\beta \in \mathbb {R} ^{p}}{\biggl \{}{\biggl \|}y-\sum _{j=1}^{J}X_{j}\beta _{j}{\biggr \|}_{2}^{2}+\lambda \sum _{j=1}^{J}\|\beta _{j}\|_{K_{j}}{\biggr \}},\qquad \|z\|_{K_{j}}=(z^{t}K_{j}z)^{1/2}}
where the design matrix
X
{\displaystyle X}
and covariate vector
β
{\displaystyle \beta }
have been replaced by a collection of design matrices
X
j
{\displaystyle X_{j}}
and covariate vectors
β
j
{\displaystyle \beta _{j}}
, one for each of the J groups. Additionally, the penalty term is now a sum over
ℓ
2
{\displaystyle \ell ^{2}}
norms defined by the positive definite matrices
K
j
{\displaystyle K_{j}}
. If each covariate is in its own group and
K
j
=
I
{\displaystyle K_{j}=I}
, then this reduces to the standard lasso, while if there is only a single group and
K
1
=
I
{\displaystyle K_{1}=I}
, it reduces to ridge regression. Since the penalty reduces to an
ℓ
2
{\displaystyle \ell ^{2}}
norm on the subspaces defined by each group, it cannot select out only some of the covariates from a group, just as ridge regression cannot. However, because the penalty is the sum over the different subspace norms, as in the standard lasso, the constraint has some non-differential points, which correspond to some subspaces being identically zero. Therefore, it can set the coefficient vectors corresponding to some subspaces to zero, while only shrinking others. However, it is possible to extend the group lasso to the so-called sparse group lasso, which can select individual covariates within a group, by adding an additional
ℓ
1
{\displaystyle \ell ^{1}}
penalty to each group subspace. Another extension, group lasso with overlap allows covariates to be shared across groups, e.g., if a gene were to occur in two pathways.
The "gglasso" package by in R, allows for fast and efficient implementation of Group LASSO.
= Fused lasso
=In some cases, the phenomenon under study may have important spatial or temporal structure that must be considered during analysis, such as time series or image-based data. In 2005, Tibshirani and colleagues introduced the fused lasso to extend the use of lasso to this type of data. The fused lasso objective function is
min
β
{
1
N
∑
i
=
1
N
(
y
i
−
x
i
T
β
)
2
}
subject to
∑
j
=
1
p
|
β
j
|
≤
t
1
and
∑
j
=
2
p
|
β
j
−
β
j
−
1
|
≤
t
2
.
{\displaystyle {\begin{aligned}&\min _{\beta }{\biggl \{}{\frac {1}{N}}\sum _{i=1}^{N}\left(y_{i}-x_{i}^{T}\beta \right)^{2}{\biggr \}}\\[4pt]&{\text{ subject to }}\sum _{j=1}^{p}|\beta _{j}|\leq t_{1}{\text{ and }}\sum _{j=2}^{p}|\beta _{j}-\beta _{j-1}|\leq t_{2}.\end{aligned}}}
The first constraint is the lasso constraint, while the second directly penalizes large changes with respect to the temporal or spatial structure, which forces the coefficients to vary smoothly to reflect the system's underlying logic. Clustered lasso is a generalization of fused lasso that identifies and groups relevant covariates based on their effects (coefficients). The basic idea is to penalize the differences between the coefficients so that nonzero ones cluster. This can be modeled using the following regularization:
∑
i
<
j
p
|
β
i
−
β
j
|
≤
t
2
.
{\displaystyle \sum _{i
In contrast, variables can be clustered into highly correlated groups, and then a single representative covariate can be extracted from each cluster.
Algorithms exist that solve the fused lasso problem, and some generalizations of it. Algorithms can solve it exactly in a finite number of operations.
= Quasi-norms and bridge regression
=Lasso, elastic net, group and fused lasso construct the penalty functions from the
ℓ
1
{\displaystyle \ell ^{1}}
and
ℓ
2
{\displaystyle \ell ^{2}}
norms (with weights, if necessary). The bridge regression utilises general
ℓ
p
{\displaystyle \ell ^{p}}
norms (
p
≥
1
{\displaystyle p\geq 1}
) and quasinorms (
0
<
p
<
1
{\displaystyle 0
). For example, for p=1/2 the analogue of lasso objective in the Lagrangian form is to solve
min
β
∈
R
p
{
1
N
‖
y
−
X
β
‖
2
2
+
λ
‖
β
‖
1
/
2
}
,
{\displaystyle \min _{\beta \in \mathbb {R} ^{p}}\left\{{\frac {1}{N}}\left\|y-X\beta \right\|_{2}^{2}+\lambda {\sqrt {\|\beta \|_{1/2}}}\right\},}
where
‖
β
‖
1
/
2
=
(
∑
j
=
1
p
|
β
j
|
)
2
{\displaystyle \|\beta \|_{1/2}={\biggl (}\sum _{j=1}^{p}{\sqrt {|\beta _{j}|}}{\biggr )}^{2}}
It is claimed that the fractional quasi-norms
ℓ
p
{\displaystyle \ell ^{p}}
(
0
<
p
<
1
{\displaystyle 0
) provide more meaningful results in data analysis both theoretically and empirically. The non-convexity of these quasi-norms complicates the optimization problem. To solve this problem, an expectation-minimization procedure is developed and implemented for minimization of function
min
β
∈
R
p
{
1
N
‖
y
−
X
β
‖
2
2
+
λ
∑
j
=
1
p
ϑ
(
β
j
2
)
}
,
{\displaystyle \min _{\beta \in \mathbb {R} ^{p}}\left\{{\frac {1}{N}}\left\|y-X\beta \right\|_{2}^{2}+\lambda \sum _{j=1}^{p}\vartheta (\beta _{j}^{2})\right\},}
where
ϑ
(
γ
)
{\displaystyle \vartheta (\gamma )}
is an arbitrary concave monotonically increasing function (for example,
ϑ
(
γ
)
=
γ
{\displaystyle \vartheta (\gamma )={\sqrt {\gamma }}}
gives the lasso penalty and
ϑ
(
γ
)
=
γ
1
/
4
{\displaystyle \vartheta (\gamma )=\gamma ^{1/4}}
gives the
ℓ
1
/
2
{\displaystyle \ell ^{1/2}}
penalty).
The efficient algorithm for minimization is based on piece-wise quadratic approximation of subquadratic growth (PQSQ).
= Adaptive lasso
=The adaptive lasso was introduced by Zou in 2006 for linear regression and by Zhang and Lu in 2007 for proportional hazards regression.
= Prior lasso
=The prior lasso was introduced for generalized linear models by Jiang et al. in 2016 to incorporate prior information, such as the importance of certain covariates. In prior lasso, such information is summarized into pseudo responses (called prior responses)
y
^
p
{\displaystyle {\hat {y}}^{\mathrm {p} }}
and then an additional criterion function is added to the usual objective function with a lasso penalty. Without loss of generality, in linear regression, the new objective function can be written as
min
β
∈
R
p
{
1
N
‖
y
−
X
β
‖
2
2
+
1
N
η
‖
y
^
p
−
X
β
‖
2
2
+
λ
‖
β
‖
1
}
,
{\displaystyle \min _{\beta \in \mathbb {R} ^{p}}\left\{{\frac {1}{N}}\left\|y-X\beta \right\|_{2}^{2}+{\frac {1}{N}}\eta \left\|{\hat {y}}^{\mathrm {p} }-X\beta \right\|_{2}^{2}+\lambda \|\beta \|_{1}\right\},}
which is equivalent to
min
β
∈
R
p
{
1
N
‖
y
~
−
X
β
‖
2
2
+
λ
1
+
η
‖
β
‖
1
}
,
{\displaystyle \min _{\beta \in \mathbb {R} ^{p}}\left\{{\frac {1}{N}}\left\|{\tilde {y}}-X\beta \right\|_{2}^{2}+{\frac {\lambda }{1+\eta }}\|\beta \|_{1}\right\},}
the usual lasso objective function with the responses
y
{\displaystyle y}
being replaced by a weighted average of the observed responses and the prior responses
y
~
=
(
y
+
η
y
^
p
)
/
(
1
+
η
)
{\displaystyle {\tilde {y}}=(y+\eta {\hat {y}}^{\mathrm {p} })/(1+\eta )}
(called the adjusted response values by the prior information).
In prior lasso, the parameter
η
{\displaystyle \eta }
is called a balancing parameter, in that it balances the relative importance of the data and the prior information. In the extreme case of
η
=
0
{\displaystyle \eta =0}
, prior lasso is reduced to lasso. If
η
=
∞
{\displaystyle \eta =\infty }
, prior lasso will solely rely on the prior information to fit the model. Furthermore, the balancing parameter
η
{\displaystyle \eta }
has another appealing interpretation: it controls the variance of
β
{\displaystyle \beta }
in its prior distribution from a Bayesian viewpoint.
Prior lasso is more efficient in parameter estimation and prediction (with a smaller estimation error and prediction error) when the prior information is of high quality, and is robust to the low quality prior information with a good choice of the balancing parameter
η
{\displaystyle \eta }
.
Computing lasso solutions
The loss function of the lasso is not differentiable, but a wide variety of techniques from convex analysis and optimization theory have been developed to compute the solutions path of the lasso. These include coordinate descent, subgradient methods, least-angle regression (LARS), and proximal gradient methods. Subgradient methods are the natural generalization of traditional methods such as gradient descent and stochastic gradient descent to the case in which the objective function is not differentiable at all points. LARS is a method that is closely tied to lasso models, and in many cases allows them to be fit efficiently, though it may not perform well in all circumstances. LARS generates complete solution paths. Proximal methods have become popular because of their flexibility and performance and are an area of active research. The choice of method will depend on the particular lasso variant, the data and the available resources. However, proximal methods generally perform well.
The "glmnet" package in R, where "glm" is a reference to "generalized linear models" and "net" refers to the "net" from "elastic net" provides an extremely efficient way to implement LASSO and some of its variants.
The "celer" package in Python provides a highly efficient solver for the Lasso problem, often outperforming traditional solvers like scikit-learn by up to 100 times in certain scenarios, particularly with high-dimensional datasets. This package leverages dual extrapolation techniques to achieve its performance gains. The celer package is available at GitHub.
Choice of regularization parameter
Choosing the regularization parameter (
λ
{\displaystyle \lambda }
) is a fundamental part of lasso. A good value is essential to the performance of lasso since it controls the strength of shrinkage and variable selection, which, in moderation can improve both prediction accuracy and interpretability. However, if the regularization becomes too strong, important variables may be omitted and coefficients may be shrunk excessively, which can harm both predictive capacity and inferencing. Cross-validation is often used to find the regularization parameter.
Information criteria such as the Bayesian information criterion (BIC) and the Akaike information criterion (AIC) might be preferable to cross-validation, because they are faster to compute and their performance is less volatile in small samples. An information criterion selects the estimator's regularization parameter by maximizing a model's in-sample accuracy while penalizing its effective number of parameters/degrees of freedom. Zou et al. proposed to measure the effective degrees of freedom by counting the number of parameters that deviate from zero. The degrees of freedom approach was considered flawed by Kaufman and Rosset and Janson et al., because a model's degrees of freedom might increase even when it is penalized harder by the regularization parameter. As an alternative, the relative simplicity measure defined above can be used to count the effective number of parameters. For the lasso, this measure is given by
P
^
=
∑
i
=
1
p
|
β
i
−
β
0
,
i
|
1
p
∑
l
|
b
OLS
,
l
−
β
0
,
l
|
,
{\displaystyle {\hat {\mathcal {P}}}=\sum _{i=1}^{p}{\frac {|\beta _{i}-\beta _{0,i}|}{{\frac {1}{p}}\sum _{l}|b_{{\text{OLS}},l}-\beta _{0,l}|}},}
which monotonically increases from zero to
p
{\displaystyle p}
as the regularization parameter decreases from
∞
{\displaystyle \infty }
to zero.
Selected applications
LASSO has been applied in economics and finance, and was found to improve prediction and to select sometimes neglected variables, for example in corporate bankruptcy prediction literature, or high growth firms prediction.
See also
Least absolute deviations
Model selection
Nonparametric regression
Tikhonov regularization
References
Kata Kunci Pencarian:
- Short program (seluncur indah)
- Lasso (statistics)
- Graphical lasso
- Outline of statistics
- Lasso (disambiguation)
- Stepwise regression
- Nonparametric regression
- Total variation denoising
- High-dimensional statistics
- Elastic net regularization
- Least-angle regression