python - 在 sklearn elastic net 中,alpha 和 l1_ratio 如何与 lambda_1 和 lambda_2 相关

标签 python scikit-learn

在 Zou 和 Hastie 的论文中 http://www.stanford.edu/~hastie/Papers/elasticnet.pdf弹性网定义有两个正则化参数 λ1 和 λ2。它们还提供了另一种使用弹性网惩罚项 a 的形式,其中约束 alpha 定义为 α = λ2/λ1 + λ2。

我的问题是在 scikit-learn elastic net 模块中,alpha 和 l1_ratio 参数与论文中的参数有什么关系?

据我了解,sklearn 中的 l1_ratio 等于 λ2/λ1 + λ2。而 sklearn 中的 alpha 等于 λ1 + λ2。这是正确的吗?

最佳答案

这是写在 docstring of the ElasticNet 中的类:

sklearn.linear_model.ElasticNet 最小化的目标函数为:

1 / (2 * n_samples) * ||y - Xw||^2_2 + alpha * l1_ratio * ||w||_1 + 0.5 * alpha * (1 - l1_ratio) * ||w||^2_2

所以 lamba_1 == alpha * l1_ratiolambda_2 == 0.5 * alpha * (1 - l1_ratio)

关于python - 在 sklearn elastic net 中,alpha 和 l1_ratio 如何与 lambda_1 和 lambda_2 相关,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22502948/

相关文章:

python - 如何从数据框中删除任何行中包含特定值的列

python - 创建由另一列 pandas 分组的一列的排列

python - 模块未找到错误 : No module named 'sklearn.neighbours'

scikit-learn SVM 有很多样本/小批量可能吗?

python - Class_weight 和 sample_weight 对 sklearn Random Forest 无效

python - 向 Numpy 数组添加新列/数组

python - 类型错误 : invalid type promotion while fitting a logistic regression model in Scikit-learn

Python:如何使用 pyaudio 获取 Google Cloud Speech API 的原始音频文件

python - 谷歌应用引擎 : Database object is not iterable

python - 调用全局变量时无法解析的引用?