逻辑回归-岭回归和Lasso的系数位置

60 阅读2分钟

开启掘金成长之旅!这是我参与「掘金日新计划 · 2 月更文挑战」的第 14 天,点击查看活动详情

The logistic regression is implemented in LogisticRegression. Despite its name, it is implemented as a linear model for classification rather than regression in terms of the scikit-learn/ML nomenclature. The logistic regression is also known in the literature as logit regression, maximum-entropy classification (MaxEnt) or the log-linear classifier. In this model, the probabilities describing the possible outcomes of a single trial are modeled using a logistic function.

逻辑回归在 LogisticRegression 中实现。尽管它的名字中有“回归”,但作为一个线性模型用于分类,而不是根据 scikit learn/ML 命名法用于回归。逻辑回归在文献中也称为 logit regression、maximum-entropy classification(MaxEnt)或 log-linear classifier。在该模型中,使用逻辑函数对描述单个试验可能结果的概率进行建模。

Ridge regression addresses some of the problems of Ordinary Least Squares by imposing a penalty on the size of the coefficients. The ridge coefficients minimize a penalized residual sum of squares:

岭回归通过调整系数大小施加不同程度的惩罚来解决不同最小惩罚的一些问题。岭回归的系数是最小化残差平方和惩罚项的系数

minwXwy22+αw22\min_{w} || X w - y||_2^2 + \alpha ||w||_2^2

The Lasso is a linear model that estimates sparse coefficients. It is useful in some contexts due to its tendency to prefer solutions with fewer non-zero coefficients, effectively reducing the number of features upon which the given solution is dependent.

Lasso 是一个稀疏系数的线性模型。它在某些情况下很有用,因为它倾向于选择具有较少非零系数的结果,从而给定结果的基础上,有效地减少了所需要的特征数量。

Mathematically, it consists of a linear model with an added regularization term. The objective function to minimize is:

数学上,它由一个线性模型和一个正则化项组成。最小化的目标函数是:

minw12nsamplesXwy22+αw1\min_{w} { \frac{1}{2n_{\text{samples}}} ||X w - y||_2 ^ 2 + \alpha ||w||_1}

The lasso estimate thus solves the minimization of the least-squares penalty with αw1\alpha ||w||_1 added, where α\alpha is a constant and w1||w||_1 is the l1l_1 -norm of the coefficient vector.

因此,Lasso 通过添加 αw1\alpha ||w||_1 解决了最小二乘法惩罚项的最小化问题,其中 α\alpha 是常数,w1||w||_1 是 l1 范数的系数向量