# Least Absolute Shrinkage and Selection Operator (LASSO)¶

Least Absolute Shrinkage and Selection Operator (LASSO) is a method for modeling relationship between a dependent variable (which may be a vector) and one or more explanatory variables by fitting regularized least squares model. Trained LASSO model can produce sparse coefficients due to the use of $$L_1$$ regularization term. LASSO regression is widely used in feature selection tasks. For example, in the field of compressed sensing it is used to effectively identify relevant features associated with the dependent variable from a few observations with a large number of features. LASSO regression is also used to overcome multicollinearity of feature vectors in the training data set.

## Details¶

Let $$(x_1, \ldots, x_p)$$ be a vector of input variables and $$y = (y_1, \ldots, y_k)$$ be the response. For each $$j = 1, \ldots, k$$, the LASSO model has the form similar to linear and ridge regression model [Hoerl70], except that the coefficients are trained by minimizing a regularized by $$L_1$$ penalty mean squared error (MSE) objective function.

$y_j = \beta_{0j} + x_1 \beta_{1j} + \ldots + x_p \beta_{pj}$

Here $$x_i$$, $$i = 1, \ldots, p$$ are referred to as independent variables, $$y_j$$ is referred to as dependent variable or response and $$j = 1, \ldots, k$$.

### Training Stage¶

Let $$(x_{11}, \ldots, x_{1p}, y_{11}, \ldots, y_{1k}) \ldots (x_{n1}, \ldots, x_{np}, y_{n1}, \ldots, y_{nk})$$ be a set of training data (for regression task, $$n >> p$$, and for feature selection $$p$$ could be greater than $$n$$). The matrix $$X$$ of size $$n \times p$$ contains observations $$x_{ij}$$, $$i = 1, \ldots, n$$, $$j = 1, \ldots, p$$ of independent variables.

For each $$y_j$$, $$j = 1, \ldots, k$$, the LASSO regression estimates $$(\beta_{0j}, \beta_{1j}, \ldots, \beta_{pj})$$ by minimizing the objective function:

$F_j(\beta) = \frac{1}{2n} \sum_{i=1}^{n}(y_{ij} - \beta_{0j} - \sum_{q=1}^{p}{\beta_{qj}x_{iq})^2} + \lambda_{1j} \sum_{q=1}^{p}|\beta_{qj}|$

In the equation above, the first term is a mean squared error function and the second one is a regularization term that penalizes the $$L_1$$ norm of vector $$\beta_j$$

For more details, see [Hastie2009].

By default, Coordinate Descent iterative solver is used to minimize the objective function. SAGA solver is also applicable for minimization.

### Prediction Stage¶

For input vector of independent variables $$(x_1, \ldots, x_p)$$, prediction based on LASSO regression is done using the equation

$y_j = \beta_{0j} + x_1 \beta_{1j} + \ldots + x_p \beta_{pj}$

where $$j = 1, \ldots, k$$.