套索回归 岭回归

Recently my class has been covering topics of regression and classification. We are now able to use the data that we have to make predictions, analyze the data better, and draw significant conclusions. We are able to do this by building models to predict data and see the most important features influencing a target variable. There are many ways to build these models depending on the data that is given and what you are trying to draw from the data. For example if you are trying to predict a continuous variable, you are going to want to use a linear regression model. But if you are trying to predict a classified variable, you are going to want to use something like a decision tree or a logistic regression model. There are also many other models to use that I wont get into in this post. In this post, I will be going over 2 key tools that will help your model predict data it hasn’t seen before. These are called Ridge and Lasso.

最近,我的课程涵盖了回归和分类的主题。 现在,我们可以使用进行预测所需的数据,更好地分析数据并得出重要结论。 通过构建模型来预测数据并查看影响目标变量的最重要功能,我们能够做到这一点。 有多种方法可以根据给定的数据以及您要从数据中提取的内容来构建这些模型。 例如,如果您尝试预测连续变量,则将要使用线性回归模型。 但是,如果您要预测分类变量,则将要使用决策树或逻辑回归模型之类的东西。 在本文中,我也不会涉及其他许多模型。 在本文中,我将介绍2个关键工具,这些工具将帮助您的模型预测以前从未见过的数据。 这些分别称为Ridge和Lasso。

正则化 (Regularization)

Regularization is a technique that will help a model perform on data that it has not seen before. This is very important to do if the model is overfit to the data the model is fit too. Regularization will also help the bias and variance tradeoff which is very important to a having a good model. This can also be helpful if you do not have as many data points as you would like, regularizing the model will help generalize the model rather than over-fitting to the data you have. The two most common ways to fix these problems and regularize your data are Ridge and Lasso.

正则化是一种技术,可以帮助模型对之前从未见过的数据执行操作。 如果模型也过度适合模型也适合的数据,这是非常重要的。 正则化还将有助于偏差和方差折衷,这对于拥有一个好的模型非常重要。 如果您没有想要的数据点,这也将很有帮助,对模型进行正则化将有助于对模型进行泛化,而不是过度拟合所拥有的数据。 解决这些问题和规范化数据的两种最常用的方法是Ridge和Lasso。

An example of getting the best Bias-Variance tradeoff
获得最佳偏置-方差权衡的示例

岭回归(Ridge Regression)

Now we will get into Ridge regression. In Ridge regression, we are going to fit a new line to our data to help regularize our overfit model. This may cause the training error of your model to increase, but it will help the model perform on unseen data. By doing this, we are introducing bias in our model for a better tradeoff. This small increase in bias will have a big drop in variance in an over fit model and will help us in the long term. Now for the math that behind changing the model. In linear regression, Ridge regression penalizes the sum of the squared residuals + lambda * the slope². Lambda is what you determine how large you want your penalty to be. So the higher the lambda the more regularized the model will be. We can use cross validation to find the best lambda.

现在我们将进入Ridge回归。 在Ridge回归中,我们将为数据拟合一条新线,以帮助规范我们的过拟合模型。 这可能会导致模型的训练误差增加,但将有助于模型在看不见的数据上执行。 通过这样做,我们在模型中引入了偏差,以实现更好的权衡。 偏倚的这种小幅增加将使过度拟合模型的方差大幅度下降,并从长远来看对我们有帮助。 现在来看改变模型的数学原理。 在线性回归中,Ridge回归惩罚残差平方和+λ*斜率²的总和。 Lambda是您确定要加多大的罚款。 因此,lambda越高,模型将越正规化。 我们可以使用交叉验证来找到最佳的lambda。

Ridge Formula
岭公式

Fitting a ridge regression in the simplest for is shown below where alpha is the lambda we can change.

下面显示了最简单的拟合岭回归的方法,其中alpha是我们可以更改的lambda。

ridge = Ridge(alpha=1)ridge.fit(X_train, y_train)

Ridge regression will help you choose the best features of the model because it will minimize the features that do not have a large effect on the target variable, therefore using them less in the final model. As you can see Ridge regression can be very helpful to over fit data and help regularize a model.

Ridge回归将帮助您选择模型的最佳特征,因为它将使对目标变量没有太大影响的特征最小化,因此在最终模型中使用较少。 如您所见,Ridge回归对于过度拟合数据和正则化模型非常有帮助。

套索回归 (Lasso Regression)

Similar to Ridge regression, Lasso regression also helps regularize a model and can be very helpful to a model predicting on unseen data. However, Lasso regression is slightly different than ridge regression. Lets start with the formula. Instead of using a penalty that squared the slope, Lasso will take a similar equation but take the absolute value of the slope rather than square it. It will take the sum of the squared residuals + lambda * the absolute value of the slope. In Lasso, instead of just penalizing the less important features when using Ridge, Lasso may reduce the features to have zero impact on the final model. This will leave a much simpler model than when we started. This can be very helpful in interpreting the model.

与Ridge回归相似,Lasso回归还有助于规范化模型,并且对基于看不见数据的模型预测非常有帮助。 但是,套索回归与岭回归略有不同。 让我们从公式开始。 拉索将使用类似的方程式,但采用斜率的绝对值而不是对平方求平方,而不是使用对斜率求平方的罚分。 它将取残差平方的总和+λ*斜率的绝对值。 在Lasso中,Lasso可能会减少特征以对最终模型产生零影响,而不仅仅是在使用Ridge时惩罚那些次要的特征。 与我们开始时相比,这将留下一个简单得多的模型。 这对解释模型非常有帮助。

结论 (Conclusion)

Ridge and Lasso regression are very helpful when trying to regularize a model. The difference in them are important to note. Ridge regression will be better to use when there are a lot of features that are important in the model as it will penalize them, but not drop the less important ones. Lasso will be better used when there you are only trying to use the most important features in your model. Both of these models will greatly help your understanding of the model and will help the model perform better on unseen data. Thanks for reading!

在尝试对模型进行正则化时,Ridge和Lasso回归非常有用。 必须注意它们之间的差异。 当模型中有很多重要特征时,最好使用Ridge回归,因为它会惩罚它们,但不会删除次要特征。 当您仅尝试使用模型中最重要的功能时,将更好地使用套索。 这两种模型都将极大地帮助您理解模型,并有助于模型在看不见的数据上表现更好。 谢谢阅读!

一些视频链接可提供帮助 (Some Video links to help)

演示地址

演示地址

翻译自: https://medium.com/@chrisfiore13/intro-to-ridge-and-lasso-regression-e8b3271b5fd0

套索回归 岭回归


http://www.taodudu.cc/news/show-5672998.html

相关文章:

  • 稀疏结构模型——套索模型、组套索、重叠组套索模型
  • 套索 选择
  • python 套索回归_适用于python的自适应套索
  • 岭回归和套索回归
  • matplotlib部件(widgets)之套索(Lasso)
  • 安装SQL Server 2000出现“以前进行的程序安装创建了挂起的文件操作”的解决办法
  • 第一章 舔狗不得house
  • 创业潭第十期:创始人是天生的
  • 小学生评语荟萃3
  • [思考]是什么,导致了这么大的差距
  • 原画师为什么多数不到30就不做了?
  • 雪终于来了
  • 猎豹免费WiFi-随身WiFi共享热点,永久免费的无线路由器 - imsoft.cnblogs
  • 管理科学与工程案例分析:高级管理学
  • 我学习 Java 的历程和体会(写给新手看,欢迎老司机批评和建议,持续更新中)
  • 瞻博网络聚焦AI科技抗疫
  • 云计算一体机有妙用
  • labview布尔型数据开关控制指示灯比较数值颜色变化条件判断
  • 五个维度比较四种芯片在AI上的表现
  • DataX离线数据同步
  • Conda安装pytorch等库时下载速度慢的解决方案(离线下载)
  • 离线安装Oracle数据库
  • keras离线下载模型的存储位置
  • 【游戏交互设计】古登堡图:视觉流在设计中的应用
  • 共赢才是真赢!看众多网站竞相联运《古剑奇谭》
  • java 对图片格式处理,Java 图片处理 格式转换
  • php 如何处理图片流,PHP 处理图片
  • HTML大期末作业: 关于城市旅游的HTML网页设计——北京(5页) HTML+CSS+JavaScript 旅游网页设计网页HTML...
  • 用MATLAB训练caffe,[转载]windows caffe部署训练+python调用全部流程
  • 分类鱼 VGG网络 python学习 深度学习 paddlepaddle学习

套索回归 岭回归_岭和套索回归简介相关推荐

  1. logit回归模型假设_机器学习基础---逻辑回归(假设函数与线性回归不同)

    一:分类 (一)分类基础 在分类问题中,你要预测的变量y是离散的值,我们将学习一种叫做逻辑回归 (Logistic Regression) 的算法,这是目前最流行使用最广泛的一种学习算法. 在分类问题 ...

  2. python 最小二乘回归 高斯核_最经典的回归模型参数估计算法—最小二乘

    首先,我们要明白最小二乘估计是个什么东西?说的直白一点,当我们确定了一组数的模型之后,然后想通过最小二乘的办法来确定模型的参数.举个两变量(一个自变量.一个因变量)线性回归的例子来说明一下,如下面所示 ...

  3. R语言使用caret包构建岭回归模型(Ridge Regression )构建回归模型、通过method参数指定算法名称、通过trainControl函数控制训练过程

    R语言使用caret包构建岭回归模型(Ridge Regression )构建回归模型.通过method参数指定算法名称.通过trainControl函数控制训练过程 目录

  4. 多项式回归、分位数回归(Quantile Regression)、保序回归(Isotonic Regression)、RANSAC回归、核岭回归、基准回归模型(baseline)

    多项式回归.分位数回归(Quantile Regression).保序回归(Isotonic Regression).RANSAC回归.核岭回归.基准回归模型(baseline) 目录

  5. 回归的误差服从正态分布吗_盘点10大回归类型:总有一款深得你心

    全文共2507字,预计学习时长5分钟 除了统计模型和其他的一些算法,回归是机器学习成功运行的重要构成要素.回归的核心是寻找变量之间的关系,而机器学习需要根据这种关系来预测结果. 显然,任何称职的机器学 ...

  6. sklearn逻辑回归参数设置_【机器学习笔记】:逻辑回归实战练习(二)

    作者:xiaoyu 微信公众号:Python数据科学 知乎:python数据分析师 前言 前几篇介绍了逻辑回归在机器学习中的重要性:5个原因告诉你:为什么在成为数据科学家之前,"逻辑回归&q ...

  7. 主成分回归之后预测_回归分析|笔记整理(B)——主成分回归(下),偏最小二乘回归...

    大家好! 上一节我们给主成分回归开了一个头,这一节我们会继续介绍它的有关内容,并且同时会介绍另一种新的回归方法:偏最小二乘回归.这一节的理论性也比较强,主要关注了相关回归的理论上的性质与相关证明. 提 ...

  8. 逻辑回归原理梳理_以python为工具 【Python机器学习系列(九)】

    逻辑回归原理梳理_以python为工具 [Python机器学习系列(九)] 文章目录 1.传统线性回归 2.引入sigmoid函数并复合 3. 代价函数 4.似然函数也可以 5. python梯度下降 ...

  9. 回归模型中截距项的意义_中级经济师考试 回归模型

    回归,回归到哪里?它与相关的差别在哪里?大家先回想一下这个问题! 回归,回归的是事物的本质 . 回归分析就是根据相关关系的具体形态,选择一个合适的 数学模型 ,来 近似的表达变量间的依赖关系 . 回归 ...

  10. python实现逻辑回归的流程_逻辑回归原理及其python实现

    September 28, 2018 7 min to read 逻辑回归原理及其python实现 原理 逻辑回归模型: $h_{\theta}(x)=\frac{1}{1+e^{-{\theta}^ ...

最新文章

  1. boost::fusion::as_nview用法的测试程序
  2. 二:前端css,即选择器
  3. 林斌减持小米股份三天套现3.4亿引关注 小米官方、林斌齐回应...
  4. spring源码bean的加载过程
  5. 如何利用Caffe训练ImageNet分类网络
  6. mysql5.7服务端安装_windows安装 MySQL5.7服务端-Go语言中文社区
  7. 【ACC编码】基于FPGA的音频ACC编码实现
  8. 黑马学习之全平台听歌神器
  9. Deep Homography Estimation - Pytorch实现
  10. 13个提炼卖点的角度,让你的产品大卖!
  11. linux去重复程序,linux常用命令合集
  12. 芯片对蓝牙耳机影响有多大?南卡N2s发布,搭载高通3040芯片
  13. Bazel5.0.0源码安装报错:no matching function for call to ‘StrFormat(const char [28], const char*)’
  14. 面试鸭专业面试刷题网站源码 支持自由组卷/在线刷题等功能
  15. JavaFX、计算器
  16. Ant Design 编写登录和注册页面
  17. 资讯_计算机屏幕_镜面屏;
  18. FAT文件系统原理(一)
  19. matlab如何将mat转为wav,Matlab的wav文件转为mat文件源程序
  20. 鸿蒙为什么翻译成harmony,鸿蒙的英文名为什么取的是Harmony

热门文章

  1. 音乐背景声提取 matlab,如何从视频中提取背景音乐 但不要对白, 视频片段背景音乐很好听怎么提取不要有人讲话...
  2. CSS的zoom属性
  3. 云尚办公OA系统(8.微信公众号)
  4. 开源OA:手把手教你搭建OA办公系统(4)搭建报销审批流程
  5. HDU 1847 Good Luck in CET-4 Everybody
  6. 生化危机8:村庄 v1.0 二十三项修改器
  7. 管理如养蛊:为何我们总在玩竞争模式?
  8. 第四届“传智杯”全国大学生IT技能大赛-Java B组题解
  9. OmniPlayer Pro for Mac(全能多媒体播放器)
  10. nodejs模仿优酷网站,有后端