Regularized least squares

This article should be summarized in Least squares#Regularization and a link provided from there to here using the `{{Main}}` template. See guidance in Wikipedia:Summary style. (November 2020)

|

Part of a series on

Regression analysis
Models

* Linear regression
* Simple regression
* Polynomial regression
* General linear model

* Generalized linear model
* Vector generalized linear model
* Discrete choice
* Binomial regression
* Binary regression
* Logistic regression
* Multinomial logistic regression
* Mixed logit
* Probit
* Multinomial probit
* Ordered logit
* Ordered probit
* Poisson

* Multilevel model
* Fixed effects
* Random effects
* Linear mixed-effects model
* Nonlinear mixed-effects model

* Nonlinear regression
* Nonparametric
* Semiparametric
* Robust
* Quantile
* Isotonic
* Principal components
* Least angle
* Local
* Segmented

* Errors-in-variables

Estimation

* Least squares
* Linear
* Non-linear

* Ordinary
* Weighted
* Generalized
* Generalized estimating equation

* Partial
* Total
* Non-negative
* Ridge regression
* Regularized

* Least absolute deviations
* Iteratively reweighted
* Bayesian
* Bayesian multivariate
* Least-squares spectral analysis

Background

* Regression validation
* Mean and predicted response
* Errors and residuals
* Goodness of fit
* Studentized residual
* Gauss–Markov theorem

* Mathematics portal

* v
* t
* e

Regularized least squares (RLS) is a family of methods for solving the least-squares problem while using regularization to further constrain the resulting solution.

RLS is used for two main reasons. The first comes up when the number of variables in the linear system exceeds the number of observations. In such settings, the ordinary least-squares problem is ill-posed and is therefore impossible to fit because the associated optimization problem has infinitely many solutions. RLS allows the introduction of further constraints that uniquely determine the solution.

The second reason for using RLS arises when the learned model suffers from poor generalization. RLS can be used in such cases to improve the generalizability of the model by constraining it at training time. This constraint can either force the solution to be "sparse" in some way or to reflect other prior knowledge about the problem such as information about correlations between features. A Bayesian understanding of this can be reached by showing that RLS methods are often equivalent to priors on the solution to the least-squares problem.

## General formulation[edit]

Consider a learning setting given by a probabilistic space  ( X × Y , ρ ( X , Y ) ) {\displaystyle (X\times Y,\rho (X,Y))} ,  Y ∈ R {\displaystyle Y\in R} . Let  S = { x i , y i } i = 1 n {\displaystyle S=\\{x_{i},y_{i}\\}_{i=1}^{n}} denote a training set of  n {\displaystyle n} pairs i.i.d. with respect to  ρ {\displaystyle \rho } . Let  V : Y × R -> [ 0 ; ∞ ) {\displaystyle V:Y\times R\rightarrow [0;\infty )} be a loss function. Define  F {\displaystyle F} as the space of the functions such that expected risk:

ε ( f ) = ∫ V ( y , f ( x ) ) d ρ ( x , y ) {\displaystyle \varepsilon (f)=\int V(y,f(x))\,d\rho (x,y)}

is well defined. The main goal is to minimize the expected risk:

inf f ∈ F ε ( f ) {\displaystyle \inf _{f\in F}\varepsilon (f)}

Since the problem cannot be solved exactly there is a need to specify how to measure the quality of a solution. A good learning algorithm should provide an estimator with a small risk.

As the joint distribution  ρ {\displaystyle \rho } is typically unknown, the empirical risk is taken. For regularized least squares the square loss function is introduced:

ε ( f ) = 1 n ∑ i = 1 n V ( y i , f ( x i ) ) = 1 n ∑ i = 1 n ( y i − f ( x i ) ) 2 {\displaystyle \varepsilon (f)={\frac {1}{n}}\sum _{i=1}^{n}V(y_{i},f(x_{i}))={\frac {1}{n}}\sum _{i=1}^{n}(y_{i}-f(x_{i}))^{2}}

However, if the functions are from a relatively unconstrained space, such as the set of square-integrable functions on  X {\displaystyle X} , this approach may overfit the training data, and lead to poor generalization. Thus, it should somehow constrain or penalize the complexity of the function  f {\displaystyle f} . In RLS, this is accomplished by choosing functions from a reproducing kernel Hilbert space (RKHS)  H {\displaystyle {\mathcal {H}}} , and adding a regularization term to the objective function, proportional to the norm of the function in  H {\displaystyle {\mathcal {H}}} :

inf f ∈ F ε ( f ) + λ R ( f ) , λ > 0 {\displaystyle \inf _{f\in F}\varepsilon (f)+\lambda R(f),\lambda >0}

## Kernel formulation[edit]

### Definition of RKHS[edit]

A RKHS can be defined by a symmetric positive-definite kernel function K ( x , z ) {\displaystyle K(x,z)} with the reproducing property:

⟨ K x , f ⟩ H = f ( x ) , {\displaystyle \langle K_{x},f\rangle _{\mathcal {H}}=f(x),}

where  K x ( z ) = K ( x , z ) {\displaystyle K_{x}(z)=K(x,z)} . The RKHS for a kernel  K {\displaystyle K} consists of the completion of the space of functions spanned by  { K x ∣ x ∈ X } {\displaystyle \left\\{K_{x}\mid x\in X\right\\}} :  f ( x ) = ∑ i = 1 n α i K x i ( x ) , f ∈ H {\displaystyle f(x)=\sum _{i=1}^{n}\alpha _{i}K_{x_{i}}(x),\,f\in {\mathcal {H}}} , where all  α i {\displaystyle \alpha _{i}} are real numbers. Some commonly used kernels include the linear kernel, inducing the space of linear functions:

K ( x , z ) = x T z , {\displaystyle K(x,z)=x^{T}z,}

the polynomial kernel, inducing the space of polynomial functions of order  d {\displaystyle d} :

K ( x , z ) = ( x T z + 1 ) d , {\displaystyle K(x,z)=(x^{T}z+1)^{d},}

and the Gaussian kernel:

K ( x , z ) = e − ‖ x − z ‖ 2 σ 2 . {\displaystyle K(x,z)=e^{-{\frac {\|x-z\|^{2}}{\sigma ^{2}}}}.}

Note that for an arbitrary loss function  V {\displaystyle V} , this approach defines a general class of algorithms named Tikhonov regularization. For instance, using the hinge loss leads to the support vector machine algorithm, and using the epsilon-insensitive loss leads to support vector regression.

### Arbitrary kernel[edit]

The representer theorem guarantees that the solution can be written as:

f ( x ) = ∑ i = 1 n c i K ( x i , x ) {\displaystyle f(x)=\sum _{i=1}^{n}c_{i}K(x_{i},x)} for some  c ∈ R n {\displaystyle c\in \mathbb {R} ^{n}} .

The minimization problem can be expressed as:

min c ∈ R n 1 n ‖ Y − K c ‖ R n 2 + λ ‖ f ‖ H 2 , {\displaystyle \min _{c\in \mathbb {R} ^{n}}{\frac {1}{n}}\|Y-Kc\|_{\mathbb {R} ^{n}}^{2}+\lambda \|f\|_{H}^{2},}

where, with some abuse of notation, the  i , j {\displaystyle i,j} entry of kernel matrix  K {\displaystyle K} (as opposed to kernel function  K ( ⋅ , ⋅ ) {\displaystyle K(\cdot ,\cdot )} ) is  K ( x i , x j ) {\displaystyle K(x_{i},x_{j})} .

For such a function,

‖ f ‖ H 2 = ⟨ f , f ⟩ H = ⟨ ∑ i = 1 n c i K ( x i , ⋅ ) , ∑ j = 1 n c j K ( x j , ⋅ ) ⟩ H = ∑ i = 1 n ∑ j = 1 n c i c j ⟨ K ( x i , ⋅ ) , K ( x j , ⋅ ) ⟩ H = ∑ i = 1 n ∑ j = 1 n c i c j K ( x i , x j ) = c T K c , {\displaystyle {\begin{aligned}&\|f\|_{H}^{2}=\langle f,f\rangle _{H}=\left\langle \sum _{i=1}^{n}c_{i}K(x_{i},\cdot ),\sum _{j=1}^{n}c_{j}K(x_{j},\cdot )\right\rangle _{H}\\\={}&\sum _{i=1}^{n}\sum _{j=1}^{n}c_{i}c_{j}\langle K(x_{i},\cdot ),K(x_{j},\cdot )\rangle _{H}=\sum _{i=1}^{n}\sum _{j=1}^{n}c_{i}c_{j}K(x_{i},x_{j})=c^{T}Kc,\end{aligned}}}

The following minimization problem can be obtained:

min c ∈ R n 1 n ‖ Y − K c ‖ R n 2 + λ c T K c {\displaystyle \min _{c\in \mathbb {R} ^{n}}{\frac {1}{n}}\|Y-Kc\|_{\mathbb {R} ^{n}}^{2}+\lambda c^{T}Kc} .

As the sum of convex functions is convex, the solution is unique and its minimum can be found by setting the gradient w.r.t  c {\displaystyle c} to  0 {\displaystyle 0} :

− 1 n K ( Y − K c ) + λ K c = 0 ⇒ K ( K + λ n I ) c = K Y ⇒ c = ( K + λ n I ) − 1 Y , {\displaystyle -{\frac {1}{n}}K(Y-Kc)+\lambda Kc=0\Rightarrow K(K+\lambda nI)c=KY\Rightarrow c=(K+\lambda nI)^{-1}Y,}

where  c ∈ R n . {\displaystyle c\in \mathbb {R} ^{n}.}

#### Complexity[edit]

The complexity of training is basically the cost of computing the kernel matrix plus the cost of solving the linear system which is roughly  O ( n 3 ) {\displaystyle O(n^{3})} . The computation of the kernel matrix for the linear or Gaussian kernel is  O ( n 2 D ) {\displaystyle O(n^{2}D)} . The complexity of testing is  O ( n ) {\displaystyle O(n)} .

### Prediction[edit]

The prediction at a new test point  x ∗ {\displaystyle x_{*}} is:

f ( x ∗ ) = ∑ i = 1 n c i K ( x i , x ∗ ) = K ( X , X ∗ ) T c {\displaystyle f(x_{*})=\sum _{i=1}^{n}c_{i}K(x_{i},x_{*})=K(X,X_{*})^{T}c}

### Linear kernel[edit]

For convenience a vector notation is introduced. Let  X {\displaystyle X} be an  n × d {\displaystyle n\times d} matrix, where the rows are input vectors, and  Y {\displaystyle Y} a  n × 1 {\displaystyle n\times 1} vector where the entries are corresponding outputs. In terms of vectors, the kernel matrix can be written as  K = X ⁡ X T {\displaystyle \operatorname {K} =\operatorname {X} \operatorname {X} ^{T}} . The learning function can be written as:

f ( x ∗ ) = K x ∗ ⁡ c = x ∗ T X T ⁡ c = x ∗ T w {\displaystyle f(x_{*})=\operatorname {K} _{x_{*}}c=x_{*}^{T}\operatorname {X} ^{T}c=x_{*}^{T}w}

Here we define  w = X T c , w ∈ R d {\displaystyle w=X^{T}c,w\in R^{d}} . The objective function can be rewritten as:

1 n ‖ Y − K ⁡ c ‖ R n 2 + λ c T K ⁡ c = 1 n ‖ y − X ⁡ X T ⁡ c ‖ R n 2 + λ c T X ⁡ X T ⁡ c = 1 n ‖ y − X ⁡ w ‖ R n 2 + λ ‖ w ‖ R d 2 {\displaystyle {\begin{aligned}&{\frac {1}{n}}\|Y-\operatorname {K} c\|_{\mathbb {R} ^{n}}^{2}+\lambda c^{T}\operatorname {K} c\\\\[4pt]={}&{\frac {1}{n}}\|y-\operatorname {X} \operatorname {X} ^{T}c\|_{\mathbb {R} ^{n}}^{2}+\lambda c^{T}\operatorname {X} \operatorname {X} ^{T}c={\frac {1}{n}}\|y-\operatorname {X} w\|_{\mathbb {R} ^{n}}^{2}+\lambda \|w\|_{\mathbb {R} ^{d}}^{2}\end{aligned}}}

The first term is the objective function from ordinary least squares (OLS) regression, corresponding to the residual sum of squares. The second term is a regularization term, not present in OLS, which penalizes large  w {\displaystyle w} values. As a smooth finite dimensional problem is considered and it is possible to apply standard calculus tools. In order to minimize the objective function, the gradient is calculated with respect to  w {\displaystyle w} and set it to zero:

X T ⁡ X ⁡ w − X T ⁡ y + λ n w = 0 {\displaystyle \operatorname {X} ^{T}\operatorname {X} w-\operatorname {X} ^{T}y+\lambda nw=0}

w = ( X T ⁡ X + λ n I ) − 1 X T ⁡ y {\displaystyle w=(\operatorname {X} ^{T}\operatorname {X} +\lambda n\operatorname {I} )^{-1}\operatorname {X} ^{T}y}

This solution closely resembles that of standard linear regression, with an extra term  λ I {\displaystyle \lambda \operatorname {I} } . If the assumptions of OLS regression hold, the solution  w = ( X T ⁡ X ) − 1 X T ⁡ y {\displaystyle w=(\operatorname {X} ^{T}\operatorname {X} )^{-1}\operatorname {X} ^{T}y} , with  λ = 0 {\displaystyle \lambda =0} , is an unbiased estimator, and is the minimum-variance linear unbiased estimator, according to the Gauss–Markov theorem. The term  λ n I {\displaystyle \lambda n\operatorname {I} } therefore leads to a biased solution; however, it also tends to reduce variance. This is easy to see, as the covariance matrix of the  w {\displaystyle w} -values is proportional to  ( X T ⁡ X + λ n I ) − 1 {\displaystyle (\operatorname {X} ^{T}\operatorname {X} +\lambda n\operatorname {I} )^{-1}} , and therefore large values of  λ {\displaystyle \lambda } will lead to lower variance. Therefore, manipulating  λ {\displaystyle \lambda } corresponds to trading-off bias and variance. For problems with high-variance  w {\displaystyle w} estimates, such as cases with relatively small  n {\displaystyle n} or with correlated regressors, the optimal prediction accuracy may be obtained by using a nonzero  λ {\displaystyle \lambda } , and thus introducing some bias to reduce variance. Furthermore, it is not uncommon in machine learning to have cases where  n < d {\displaystyle n<d} , in which case  X T X {\displaystyle X^{T}X} is rank-deficient, and a nonzero  λ {\displaystyle \lambda } is necessary to compute  ( X T ⁡ X + λ n I ) − 1 {\displaystyle (\operatorname {X} ^{T}\operatorname {X} +\lambda n\operatorname {I} )^{-1}} .

#### Complexity[edit]

The parameter  λ {\displaystyle \lambda } controls the invertibility of the matrix  X T X + λ n I {\displaystyle X^{T}X+\lambda nI} . Several methods can be used to solve the above linear system, Cholesky decomposition being probably the method of choice, since the matrix  X T X + λ n I {\displaystyle X^{T}X+\lambda nI} is symmetric and positive definite. The complexity of this method is  O ( n D 2 ) {\displaystyle O(nD^{2})} for training and  O ( D ) {\displaystyle O(D)} for testing. The cost  O ( n D 2 ) {\displaystyle O(nD^{2})} is essentially that of computing  X T X {\displaystyle X^{T}X} , whereas the inverse computation (or rather the solution of the linear system) is roughly  O ( D 3 ) {\displaystyle O(D^{3})} .

## Feature maps and Mercer's theorem[edit]

In this section it will be shown how to extend RLS to any kind of reproducing kernel K. Instead of linear kernel a feature map is considered  Φ : X -> F {\displaystyle \Phi :X\rightarrow F} for some Hilbert space  F {\displaystyle F} , called the feature space. In this case the kernel is defined as: The matrix  X {\displaystyle X} is now replaced by the new data matrix  Φ {\displaystyle \Phi } , where  Φ i j = φ j ( x i ) {\displaystyle \Phi _{ij}=\varphi _{j}(x_{i})} , or the  j {\displaystyle j} -th component of the  φ ( x i ) {\displaystyle \varphi (x_{i})} .

K ( x , x ′ ) = ⟨ Φ ( x ) , Φ ( x ′ ) ⟩ F . {\displaystyle K(x,x')=\langle \Phi (x),\Phi (x')\rangle _{F}.}

It means that for a given training set  K = Φ Φ T {\displaystyle K=\Phi \Phi ^{T}} . Thus, the objective function can be written as

min c ∈ R n ‖ Y − Φ Φ T c ‖ R n 2 + λ c T Φ Φ T c . {\displaystyle \min _{c\in \mathbb {R} ^{n}}\|Y-\Phi \Phi ^{T}c\|_{\mathbb {R} ^{n}}^{2}+\lambda c^{T}\Phi \Phi ^{T}c.}

This approach is known as the kernel trick. This technique can significantly simplify the computational operations. If  F {\displaystyle F} is high dimensional, computing  φ ( x i ) {\displaystyle \varphi (x_{i})} may be rather intensive. If the explicit form of the kernel function is known, we just need to compute and store the  n × n {\displaystyle n\times n} kernel matrix  K {\displaystyle \operatorname {K} } .

In fact, the Hilbert space F {\displaystyle F} need not be isomorphic to  R m {\displaystyle \mathbb {R} ^{m}} , and can be infinite dimensional. This follows from Mercer's theorem, which states that a continuous, symmetric, positive definite kernel function can be expressed as

K ( x , z ) = ∑ i = 1 ∞ σ i e i ( x ) e i ( z ) {\displaystyle K(x,z)=\sum _{i=1}^{\infty }\sigma _{i}e_{i}(x)e_{i}(z)}

where  e i ( x ) {\displaystyle e_{i}(x)} form an orthonormal basis for  ℓ 2 ( X ) {\displaystyle \ell ^{2}(X)} , and  σ i ∈ R {\displaystyle \sigma _{i}\in \mathbb {R} } . If feature maps is defined  φ ( x ) {\displaystyle \varphi (x)} with components  φ i ( x ) = σ i e i ( x ) {\displaystyle \varphi _{i}(x)={\sqrt {\sigma _{i}}}e_{i}(x)} , it follows that  K ( x , z ) = ⟨ φ ( x ) , φ ( z ) ⟩ {\displaystyle K(x,z)=\langle \varphi (x),\varphi (z)\rangle } . This demonstrates that any kernel can be associated with a feature map, and that RLS generally consists of linear RLS performed in some possibly higher-dimensional feature space. While Mercer's theorem shows how one feature map that can be associated with a kernel, in fact multiple feature maps can be associated with a given reproducing kernel. For instance, the map  φ ( x ) = K x {\displaystyle \varphi (x)=K_{x}} satisfies the property  K ( x , z ) = ⟨ φ ( x ) , φ ( z ) ⟩ {\displaystyle K(x,z)=\langle \varphi (x),\varphi (z)\rangle } for an arbitrary reproducing kernel.

## Bayesian interpretation[edit]

Further information: Bayesian linear regression and Bayesian interpretation of kernel regularization

Least squares can be viewed as a likelihood maximization under an assumption of normally distributed residuals. This is because the exponent of the Gaussian distribution is quadratic in the data, and so is the least-squares objective function. In this framework, the regularization terms of RLS can be understood to be encoding priors on  w {\displaystyle w} . For instance, Tikhonov regularization corresponds to a normally distributed prior on  w {\displaystyle w} that is centered at 0. To see this, first note that the OLS objective is proportional to the log-likelihood function when each sampled  y i {\displaystyle y^{i}} is normally distributed around  w T ⋅ x i {\displaystyle w^{T}\cdot x^{i}} . Then observe that a normal prior on  w {\displaystyle w} centered at 0 has a log-probability of the form

log ⁡ P ( w ) = q − α ∑ j = 1 d w j 2 {\displaystyle \log P(w)=q-\alpha \sum _{j=1}^{d}w_{j}^{2}}

where  q {\displaystyle q} and  α {\displaystyle \alpha } are constants that depend on the variance of the prior and are independent of  w {\displaystyle w} . Thus, minimizing the logarithm of the likelihood times the prior is equivalent to minimizing the sum of the OLS loss function and the ridge regression regularization term.

This gives a more intuitive interpretation for why Tikhonov regularization leads to a unique solution to the least-squares problem: there are infinitely many vectors  w {\displaystyle w} satisfying the constraints obtained from the data, but since we come to the problem with a prior belief that  w {\displaystyle w} is normally distributed around the origin, we will end up choosing a solution with this constraint in mind.

Other regularization methods correspond to different priors. See the list below for more details.

## Specific examples[edit]

### Ridge regression (or Tikhonov regularization)[edit]

Main article: Ridge regression (or Tikhonov regularization)

One particularly common choice for the penalty function  R {\displaystyle R} is the squared  ℓ 2 {\displaystyle \ell _{2}} norm, i.e.,

R ( w ) = ∑ j = 1 d w j 2 {\displaystyle R(w)=\sum _{j=1}^{d}w_{j}^{2}}
1 n ‖ Y − X ⁡ w ‖ 2 2 + λ ∑ j = 1 d | w j | 2 -> min w ∈ R d {\displaystyle {\frac {1}{n}}\|Y-\operatorname {X} w\|_{2}^{2}+\lambda \sum _{j=1}^{d}|w_{j}|^{2}\rightarrow \min _{w\in \mathbb {R} ^{d}}}

The most common names for this are called Tikhonov regularization and ridge regression. It admits a closed-form solution for  w {\displaystyle w} :

w = ( X T X + λ I ) − 1 X T Y {\displaystyle w=(X^{T}X+\lambda I)^{-1}X^{T}Y}

The name ridge regression alludes to the fact that the  λ I {\displaystyle \lambda I} term adds positive entries along the diagonal "ridge" of the sample covariance matrix X T X {\displaystyle X^{T}X} .

When  λ = 0 {\displaystyle \lambda =0} , i.e., in the case of ordinary least squares, the condition that  d > n {\displaystyle d>n} causes the sample covariance matrix X T X {\displaystyle X^{T}X} to not have full rank and so it cannot be inverted to yield a unique solution. This is why there can be an infinitude of solutions to the ordinary least squares problem when  d > n {\displaystyle d>n} . However, when  λ > 0 {\displaystyle \lambda >0} , i.e., when ridge regression is used, the addition of  λ I {\displaystyle \lambda I} to the sample covariance matrix ensures that all of its eigenvalues will be strictly greater than 0. In other words, it becomes invertible, and the solution becomes unique.

Compared to ordinary least squares, ridge regression is not unbiased. It accepts bias to reduce variance and the mean square error.

### Lasso regression[edit]

Main article: Lasso (statistics)

The least absolute selection and shrinkage (LASSO) method is another popular choice. In lasso regression, the lasso penalty function  R {\displaystyle R} is the  ℓ 1 {\displaystyle \ell _{1}} norm, i.e.

R ( w ) = ∑ j = 1 d | w j | {\displaystyle R(w)=\sum _{j=1}^{d}\left|w_{j}\right|}
1 n ‖ Y − X ⁡ w ‖ 2 2 + λ ∑ j = 1 d | w j | -> min w ∈ R d {\displaystyle {\frac {1}{n}}\|Y-\operatorname {X} w\|_{2}^{2}+\lambda \sum _{j=1}^{d}|w_{j}|\rightarrow \min _{w\in \mathbb {R} ^{d}}}

Note that the lasso penalty function is convex but not strictly convex. Unlike Tikhonov regularization, this scheme does not have a convenient closed-form solution: instead, the solution is typically found using quadratic programming or more general convex optimization methods, as well as by specific algorithms such as the least-angle regression algorithm.

An important difference between lasso regression and Tikhonov regularization is that lasso regression forces more entries of  w {\displaystyle w} to actually equal 0 than would otherwise. In contrast, while Tikhonov regularization forces entries of  w {\displaystyle w} to be small, it does not force more of them to be 0 than would be otherwise. Thus, LASSO regularization is more appropriate than Tikhonov regularization in cases in which we expect the number of non-zero entries of  w {\displaystyle w} to be small, and Tikhonov regularization is more appropriate when we expect that entries of  w {\displaystyle w} will generally be small but not necessarily zero. Which of these regimes is more relevant depends on the specific data set at hand.

Besides feature selection described above, LASSO has some limitations. Ridge regression provides better accuracy in the case  n > d {\displaystyle n>d} for highly correlated variables.[1] In another case,  n < d {\displaystyle n<d} , LASSO selects at most  n {\displaystyle n} variables. Moreover, LASSO tends to select some arbitrary variables from group of highly correlated samples, so there is no grouping effect.

### ℓ0 Penalization[edit]

1 n ‖ Y − X ⁡ w ‖ 2 2 + λ ‖ w j ‖ 0 -> min w ∈ R d {\displaystyle {\frac {1}{n}}\|Y-\operatorname {X} w\|_{2}^{2}+\lambda \|w_{j}\|_{0}\rightarrow \min _{w\in \mathbb {R} ^{d}}}

The most extreme way to enforce sparsity is to say that the actual magnitude of the coefficients of  w {\displaystyle w} does not matter; rather, the only thing that determines the complexity of  w {\displaystyle w} is the number of non-zero entries. This corresponds to setting  R ( w ) {\displaystyle R(w)} to be the  ℓ 0 {\displaystyle \ell _{0}} norm of  w {\displaystyle w} . This regularization function, while attractive for the sparsity that it guarantees, is very difficult to solve because doing so requires optimization of a function that is not even weakly convex. Lasso regression is the minimal possible relaxation of  ℓ 0 {\displaystyle \ell _{0}} penalization that yields a weakly convex optimization problem.

### Elastic net[edit]

Main article: Elastic net regularization

For any non-negative  λ 1 {\displaystyle \lambda _{1}} and  λ 2 {\displaystyle \lambda _{2}} the objective has the following form:

1 n ‖ Y − X ⁡ w ‖ 2 2 + λ 1 ∑ j = 1 d | w j | + λ 2 ∑ j = 1 d | w j | 2 -> min w ∈ R d {\displaystyle {\frac {1}{n}}\|Y-\operatorname {X} w\|_{2}^{2}+\lambda _{1}\sum _{j=1}^{d}|w_{j}|+\lambda _{2}\sum _{j=1}^{d}|w_{j}|^{2}\rightarrow \min _{w\in \mathbb {R} ^{d}}}

Let  α = λ 1 λ 1 + λ 2 {\displaystyle \alpha ={\frac {\lambda _{1}}{\lambda _{1}+\lambda _{2}}}} , then the solution of the minimization problem is described as:

1 n ‖ Y − X ⁡ w ‖ 2 2 -> min w ∈ R d s.t. ( 1 − α ) ‖ w ‖ 1 + α ‖ w ‖ 2 ≤ t {\displaystyle {\frac {1}{n}}\|Y-\operatorname {X} w\|_{2}^{2}\rightarrow \min _{w\in \mathbb {R} ^{d}}{\text{ s.t. }}(1-\alpha )\|w\|_{1}+\alpha \|w\|_{2}\leq t} for some  t {\displaystyle t} .

Consider  ( 1 − α ) ‖ w ‖ 1 + α ‖ w ‖ 2 ≤ t {\displaystyle (1-\alpha )\|w\|_{1}+\alpha \|w\|_{2}\leq t} as an Elastic Net penalty function.

When  α = 1 {\displaystyle \alpha =1} , elastic net becomes ridge regression, whereas  α = 0 {\displaystyle \alpha =0} it becomes Lasso.  ∀ α ∈ ( 0 , 1 ] {\displaystyle \forall \alpha \in (0,1]} Elastic Net penalty function doesn't have the first derivative at 0 and it is strictly convex  ∀ α > 0 {\displaystyle \forall \alpha >0} taking the properties both lasso regression and ridge regression.

One of the main properties of the Elastic Net is that it can select groups of correlated variables. The difference between weight vectors of samples  x i {\displaystyle x_{i}} and  x j {\displaystyle x_{j}} is given by:

| w i ∗ ( λ 1 , λ 2 ) − w j ∗ ( λ 1 , λ 2 ) | ≤ ∑ i = 1 n | y i | λ 2 2 ( 1 − ρ i j ) {\displaystyle |w_{i}^{*}(\lambda _{1},\lambda _{2})-w_{j}^{*}(\lambda _{1},\lambda _{2})|\leq {\frac {\sum _{i=1}^{n}|y_{i}|}{\lambda _{2}}}{\sqrt {2(1-\rho _{ij})}}} , where  ρ i j = x i T x j {\displaystyle \rho _{ij}=x_{i}^{T}x_{j}} .[2]

If  x i {\displaystyle x_{i}} and  x j {\displaystyle x_{j}} are highly correlated (  ρ i j -> 1 {\displaystyle \rho _{ij}\rightarrow 1} ), the weight vectors are very close. In the case of negatively correlated samples (  ρ i j -> − 1 {\displaystyle \rho _{ij}\rightarrow -1} ) the samples  − x j {\displaystyle -x_{j}} can be taken. To summarize, for highly correlated variables the weight vectors tend to be equal up to a sign in the case of negative correlated variables.

## Partial list of RLS methods[edit]

The following is a list of possible choices of the regularization function  R ( ⋅ ) {\displaystyle R(\cdot )} , along with the name for each one, the corresponding prior if there is a simple one, and ways for computing the solution to the resulting optimization problem.

Name | Regularization function | Corresponding prior | Methods for solving

|
|
|

Tikhonov regularization |  ‖ w ‖ 2 2 {\displaystyle \|w\|_{2}^{2}} | Normal | Closed form
Lasso regression |  ‖ w ‖ 1 {\displaystyle \|w\|_{1}} | Laplace | Proximal gradient descent, least angle regression
ℓ 0 {\displaystyle \ell _{0}} penalization |  ‖ w ‖ 0 {\displaystyle \|w\|_{0}} | – | Forward selection, Backward elimination, use of priors such as spike and slab
Elastic nets |  β ‖ w ‖ 1 + ( 1 − β ) ‖ w ‖ 2 2 {\displaystyle \beta \|w\|_{1}+(1-\beta )\|w\|_{2}^{2}} | Normal and Laplace mixture | Proximal gradient descent
Total variation regularization |  ∑ j = 1 d − 1 | w j + 1 − w j | {\displaystyle \sum _{j=1}^{d-1}|w_{j+1}-w_{j}|} | – | Split–Bregman method, among others

## See also[edit]

* Least squares
* Regularization in mathematics.
* Generalization error, one of the reasons regularization is used.
* Tikhonov regularization
* Lasso regression
* Elastic net regularization
* Least-angle regression

## References[edit]

1. ^ Tibshirani Robert (1996). "Regression shrinkage and selection via the lasso" (PDF). Journal of the Royal Statistical Society, Series B. 58: pp. 266–288.
2. ^ Hui, Zou; Hastie, Trevor (2003). "Regularization and Variable Selection via the Elastic Net" (PDF). Journal of the Royal Statistical Society, Series B. 67 (2): pp. 301–320.

## External links[edit]

* http://www.stanford.edu/~hastie/TALKS/enet_talk.pdf Regularization and Variable Selection via the Elastic Net (presentation)
* Regularized Least Squares and Support Vector Machines (presentation)
* Regularized Least Squares(presentation)

*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template