Lasso算法
在统计学和机器学习中，Lasso算法（英语：least absolute shrinkage and selection operator，又译最小绝对值收敛和选择算子、套索算法）是一种同时进行特征选择和正则化（数学）的回归分析方法，旨在增强统计模型的预测准确性和可解释性，最初由斯坦福大学统计学教授于1996年基于Leo Breiman的非负参数推断(Nonnegative Garrote, NNG)提出。Lasso算法最初用于计算最小二乘法模型，这个简单的算法揭示了很多估计量的重要性质，如估计量与岭回归（Ridge regression，也叫吉洪诺夫正则化）和最佳子集选择的关系，Lasso系数估计值(estimate)和软阈值（soft thresholding）之间的联系。它也揭示了当协变量共线时，Lasso系数估计值不一定唯一（类似标准线性回归）。
虽然最早是为应用最小二乘法而定义的算法，lasso正则化可以简单直接地拓展应用于许多统计学模型上，包括广义线性模型，广义估计方程，成比例灾难模型和M-估计。Lasso选择子集的能力依赖于限制条件的形式并且有多种表现形式，包括几何学，贝叶斯统计，和凸分析。
Lasso算法与基追踪降噪联系紧密。
Robert Tibshirani最初使用Lasso来提高预测的准确性与回归模型的可解释性，他修改了模型拟合的过程，在协变量中只选择一个子集应用到最终模型中，而非用上全部协变量。这是基于有着相似目的，但方法有所不同的Breiman的非负参数推断。
在Lasso之前，选择模型中协变量最常用的方法是移步选择，这种方法在某些情况下是准确的，例如一些协变量与模型输出值有强相关性情况。然而在另一些情况下，这种方法会让预测结果更差。在当时，岭回归是提高模型预测准确性最常用的方法。岭回归可以通过缩小大的回归系数来减少过拟合从而改善模型预测偏差。但是它并不选择协变量，所以对模型的准确构建和解释没有帮助。
Lasso结合了上述的两种方法，它通过强制让回归系数绝对值之和小于某固定值，即强制一些回归系数变为0，有效地选择了不包括这些回归系数对应的协变量的更简单的模型。这种方法和岭回归类似，在岭回归中，回归系数平方和被强制小于某定值，不同点在于岭回归只改变系数的值，而不把任何值设为0。
Lasso最初为了最小二乘法而被设计出来，Lasso的最小二乘法应用能够简单明了地展示Lasso的许多特性。
假设一个样本包括N种事件，每个事件包括"p"个协变量和一个输出值。让formula_1为输出值，并且formula_2为第i种情况的协变量向量，那么Lasso要计算的目标方程就是：
对所有 formula_3，计算 formula_4
这里 formula_5 是一个决定规则化程度的预定的自由参数。 设formula_6为协方差矩阵，那么 formula_7，其中 formula_8 是 formula_9的第 "i" 行，那么上式可以写成更紧凑的形式：
这里 formula_12 是标准 formula_13 范数，formula_14是formula_15维的1的向量。
因为 formula_16，所以有
对变量进行中心化是常用的数据处理方法。并且协方差一般规范化为 formula_18 ，这样得到的解就不会依赖测量的规模。
它的目标方程还可以写为：
in the so-called Lagrangian form
where the exact relationship between formula_21 and formula_22 is data dependent.
Some basic properties of the lasso estimator can now be considered.
Assuming first that the covariates are orthonormal so that formula_23, where formula_24 is the inner product and formula_25 is the Kronecker delta, or, equivalently, formula_26, then using subgradient methods it can be shown that
formula_28 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 formula_29, would.
This can be compared to ridge regression, where the objective is to minimize
yielding
So ridge regression shrinks all coefficients by a uniform factor of formula_32 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
where formula_34 is the "formula_35 norm", which is defined as formula_36 if exactly m components of z are nonzero. In this case, it can be shown that
where formula_29 is the so-called hard thresholding function and formula_39 is an indicator function (it is 1 if its argument is true and 0 otherwise).
Therefore, the lasso estimates share features of the estimates from both ridge and best subset selection regression since they both shrink the magnitude of all the coefficients, like ridge regression, but also 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.
Returning to the general case, in which the different covariates may not be independent, a special case may be considered in which two of the covariates, say "j" and "k", are identical for each case, so that formula_40, where formula_41. Then the values of formula_42 and formula_43 that minimize the lasso objective function are not uniquely determined. In fact, if there is some solution formula_44 in which formula_45, then if formula_46 replacing formula_47 by formula_48 and formula_49 by formula_50, while keeping all the other formula_51 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, have been designed to address this shortcoming, which are discussed below.