梯度下降法

介绍 (Introduction)

Gradient Descent is a first order iterative optimization algorithm where optimization, often in Machine Learning refers to minimizing a cost function J(w) parameterized by the predictive model's parameters. Additionally, by first-order we mean that Gradient Descent only takes into account the first derivative when performing updates of the parameters.

梯度下降是一阶迭代优化算法,其中优化(通常在机器学习中)是指最小化由预测模型的参数参数化的成本函数J(w)。 另外,一阶是指梯度下降在执行参数更新时仅考虑一阶导数。

No matter what happens, at some point in your Machine Learning or Deep Learning journey, you will hear about something called Gradient Descent. A vital piece to the puzzle for many Machine Learning algorithms, I highly recommend that it’s not treated as a black box by practitioners.

无论发生什么情况,在您的机器学习或深度学习过程中的某个时刻,您都会听到有关梯度下降的信息。 对于许多机器学习算法来说,这是一个难题的重要组成部分,我强烈建议从业者不要将其视为黑匣子。

In order to minimize the cost function, we aim to either find the global minimum which is quite feasible if the objective function is convex. Nonetheless, in many scenarios such as deep learning task our objective function tends to be non-convex, thereby finding the lowest possible value of the objective function has been highly regarded as a suitable solution.

为了最小化成本函数,我们的目标是找到一个全局最小值,如果目标函数是凸的 ,则这是非常可行的。 尽管如此,在诸如深度学习任务之类的许多情况下,我们的目标函数往往是非凸的,因此,将目标函数的尽可能低的值视为高度合适的解决方案。

Figure 1: Convex function and Non-convex function examples.图1:凸函数和非凸函数示例。

To find the local minimum of the function we take steps proportional to the negative of the gradient of the function at the current point (Source: Wikipedia). Frankly, we start with a random point on the objective function and move in the negative direction towards the global/local minimum.

为了找到该函数的局部最小值,我们采取与该函数在当前点处的梯度的负值成比例的步骤(来源: Wikipedia )。 坦白说,我们从目标函数上的随机点开始,然后朝整个全局/局部最小值的负方向移动。

MLextend)MLextend )

There are many different adaptations that could be made to Gradient Descent to make it run more efficiently for different scenarios; Each adaptation to Gradient Descent has its own pros and cons as we will share below:

可以对Gradient Descent进行多种调整,以使其在不同情况下更有效地运行。 每种适应Gradient Descent的方法都有其优缺点,我们将在下面分享:

批次梯度下降 (Batch Gradient Descent)

Batch Gradient Descent refers to the sum of all observations on each iteration. In other words, Batch Gradient Descent calculates the error for each observation in the batch (remember this is the full training data) and updates the predictive model only after all observations have been evaluated — A more technical way to say this is “Batch Gradient Descent performs parameter updates at the end of each epoch” (one epoch refers to one iteration through the entire training data).

批梯度下降是指每次迭代中所有观测值的总和。 换句话说,批次梯度下降计算批次中每个观测值的误差(请记住,这是完整的训练数据)并仅在评估所有观测值之后才更新预测模型-一种更技术性的说法是“ 批次梯度下降”在每个时期的末尾执行参数更新 (一个时期是指整个训练数据的一次迭代)。

Figure 3: 2d Representation of Batch Gradient Descent approaching and Converging at the Global Minimum.
图3:批次梯度下降的2d表示接近并收敛于全局最小值。

Pros

优点

  • More stable convergence and error gradient than Stochastic Gradient descent比随机梯度下降法更稳定的收敛和误差梯度
  • Embraces the benefits of vectorization拥抱矢量化的好处
  • A more direct path is taken towards the minimum朝着最小方向走更直接的路径
  • Computationally efficient since updates are required after the run of an epoch计算效率高,因为在运行纪元后需要更新

Cons

缺点

  • Can converge at local minima and saddle points可以收敛于局部最小值和鞍点
  • Slower learning since an update is performed only after we go through all observations学习更新后才进行学习,因此学习速度较慢

小批量梯度下降 (Mini-Batch Gradient Descent)

If Batch Gradient Descent sums over all observation on each iteration, Mini Batch Gradient Descent sums over a lower number of samples (a mini-batch of the samples) on each iteration — this variant reduces the variance of the gradient since we sum over a designated number of samples (depending on the mini-batch size) on each update.

如果每次迭代的所有观察结果都具有“批次梯度下降”的总和,则“每次迭代”中的较小数量的样本(样本的小批量)的“最小批次梯度下降”总和-由于我们在指定的点求和,因此该变体减小了梯度的方差每次更新的样本数(取决于最小批量)。

Note: This variation of Gradient Descent is often the recommended technique among Deep Learning practitioners, but we must consider there is an extra hyperparameter which is the “batch sizes”

注意 :这种梯度下降的变化通常是深度学习从业人员推荐的技术,但是我们必须考虑还有一个额外的超参数,即“批量大小”

Figure 4: 2d Representation of Mini-Batch Gradient approaching Minimum; (Source: https://engmrk.com/mini-batch-gd/)
图4:接近最小的小批量梯度的2d表示; (来源: https : //engmrk.com/mini-batch-gd/ )

Pros

优点

  • Convergence is more stable than Stochastic Gradient Descent收敛比随机梯度下降更稳定
  • Computationally efficient计算效率高
  • Fast Learning since we perform more updates快速学习,因为我们执行更多更新

Cons

缺点

  • We have to configure the Mini-Batch size hyperparameter我们必须配置Mini-Batch大小超参数

随机梯度下降 (Stochastic Gradient Descent)

Stochastic Gradient Descent sums the error of an individual observation and performs an update to the model on each observation — This is the same as setting the number of Mini Batches to be equal to m, where m is the number of observations.

随机梯度下降可将单个观测值的误差相加,并对每个观测值执行模型更新-这与将“迷你批次”的数量设置为等于m相同 ,其中m是观测值的数量。

Figure 5: 2d Representation of Mini-Batch Gradient approaching Minimum; (Source: https://engmrk.com/mini-batch-gd/)
图5:接近最小的小批量梯度的2d表示; (来源: https : //engmrk.com/mini-batch-gd/ )

Pros

优点

  • Only a single observation is being processed by the network so it is easier to fit into memory网络仅处理一个观测值,因此更容易放入内存
  • May (likely) to reach near the minimum (and begin to oscillate) faster than Batch Gradient Descent on a large dataset在大型数据集上,可能(可能)达到接近最小值(并开始振荡)的速度比批次梯度下降快
  • The frequent updates create plenty of oscillations which can be helpful for getting out of local minimums.频繁的更新会产生大量的振荡,这有助于摆脱局部最小值。

Cons

缺点

  • Can veer off in the wrong direction due to frequent updates由于频繁更新,可能会朝错误的方向偏离
  • Lose the benefits of vectorization since we process one observation per time由于我们每次处理一个观测值,因此失去了矢量化的好处
  • Frequent updates are computationally expensive due to using all resources for processing one training sample at a time由于一次使用所有资源来一次处理一个训练样本,因此频繁更新的计算量很大

结语 (Wrap Up)

Optimization is a major part of Machine Learning and Deep Learning. A simple and very popular optimization procedure that is employed with many Machine Learning algorithms is called Gradient descent, and there are 3 ways we can adapt Gradient Descent to perform in a specific way that suits our needs.

优化是机器学习和深度学习的主要部分。 许多机器学习算法采用的一种简单且非常流行的优化程序称为梯度下降,我们可以通过3种方法使梯度下降以适合我们需求的特定方式执行。

Let’s continue the Conversation on LinkedIn!

让我们继续在LinkedIn上进行对话!

翻译自: https://towardsdatascience.com/gradient-descent-811efcc9f1d5

梯度下降法


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

相关文章:

  • 学习机器学习的项目_辅助项目在机器学习中的重要性
  • 计算机视觉知识基础_我见你:计算机视觉基础知识
  • 配对交易方法_COVID下的自适应配对交易,一种强化学习方法
  • 设计数据密集型应用程序_设计数据密集型应用程序书评
  • pca 主成分分析_超越普通PCA:非线性主成分分析
  • 全局变量和局部变量命名规则_变量范围和LEGB规则
  • dask 使用_在Google Cloud上使用Dask进行可扩展的机器学习
  • 计算机视觉课_计算机视觉教程—第4课
  • 用camelot读取表格_如何使用Camelot从PDF提取表格
  • c盘扩展卷功能只能向右扩展_信用风险管理:功能扩展和选择
  • 使用OpenCV,Keras和Tensorflow构建Covid19掩模检测器
  • 使用Python和OpenCV创建自己的“ CamScanner”
  • cnn图像进行预测_CNN方法:使用聚合物图像预测其玻璃化转变温度
  • 透过性别看世界_透过树林看森林
  • gan神经网络_神经联觉:当艺术遇见GAN
  • rasa聊天机器人_Rasa-X是持续改进聊天机器人的独特方法
  • python进阶指南_Python特性工程动手指南
  • 人工智能对金融世界的改变_人工智能革命正在改变网络世界
  • 数据科学自动化_数据科学会自动化吗?
  • 数据结构栈和队列_使您的列表更上一层楼:链接列表和队列数据结构
  • 轨迹预测演变(第1/2部分)
  • 人口预测和阻尼-增长模型_使用分类模型预测利率-第3部分
  • 机器学习 深度学习 ai_人工智能,机器学习,深度学习-特征和差异
  • 随机模拟_随机模拟可帮助您掌握统计概念
  • 机器学习算法如何应用于控制_将机器学习算法应用于NBA MVP数据
  • 知乎 开源机器学习_使用开源数据和机器学习预测海洋温度
  • :)xception_Xception:认识Xtreme盗梦空间
  • 评估模型如何建立_建立和评估分类ML模型
  • 介绍神经网络_神经网络介绍
  • 人物肖像速写_深度视频肖像

梯度下降法_梯度下降相关推荐

  1. python实现梯度下降法_梯度下降法及其Python实现

    作者:糖甜甜甜 经管人也可以学Python. 个人公众号: 经管人学数据分析 基本介绍 梯度下降法(gradient descent),又名最速下降法(steepest descent)是求解无约束最 ...

  2. 【数据挖掘】神经网络 后向传播算法 ( 梯度下降过程 | 梯度方向说明 | 梯度下降原理 | 损失函数 | 损失函数求导 | 批量梯度下降法 | 随机梯度下降法 | 小批量梯度下降法 )

    文章目录 I . 梯度下降 Gradient Descent 简介 ( 梯度下降过程 | 梯度下降方向 ) II . 梯度下降 示例说明 ( 单个参数 ) III . 梯度下降 示例说明 ( 多个参数 ...

  3. python sklearn 梯度下降法_(四)梯度下降法及其python实现

    梯度 梯度,什么是梯度?梯度的本意是一个向量,表示某一函数在该点处的方向导数沿着该方向取得最大值,即函数在该点处沿着该方向(此梯度的方向)变化最快,变化率最大(为该梯度的模). 在微积分里面,对多元函 ...

  4. 随机梯度下降法_动量梯度下降法(gradient descent with momentum)

    简介 动量梯度下降法是对梯度下降法的改良版本,通常来说优化效果好于梯度下降法.对梯度下降法不熟悉的可以参考梯度下降法,理解梯度下降法是理解动量梯度下降法的前提,除此之外要搞懂动量梯度下降法需要知道原始 ...

  5. python实现线性回归之梯度下降法,梯度下降详解

    线性回归的有关概念已在笔者相关文章中进行介绍.本篇内容将介绍梯度下降(BGD)相关内容. 1.梯度下降 梯度下降常用于机器学习中求解符合最小损失函数的模型的参数值,梯度下降也是BP神经网络的核心,本文 ...

  6. 梯度下降算法_梯度下降法的简单介绍以及实现

    梯度下降法的基本思想可以类比为一个下山的过程.假设这样一个场景:一个人被困在山上,需要从山上下来(i.e.找到山的最低点,也就是山谷).但此时山上的浓雾很大,导致可视度很低.因此,下山的路径就无法确定 ...

  7. 梯度下降算法_梯度下降算法的工作原理

    ↑ 点击蓝字 关注极市平台作者丨 磐怼怼来源丨深度学习与计算机视觉编辑丨极市平台 极市导读 梯度下降算法是工业中最常用的机器学习算法之一,但也是很多新手难以理解的算法之一.如果你刚刚接触机器学习,那么 ...

  8. 梯度消失和梯度爆炸_梯度消失、爆炸的原因及解决办法

    一.引入:梯度更新规则 目前优化神经网络的方法都是基于反向传播的思想,即根据损失函数计算的误差通过梯度反向传播的方式,更新优化深度网络的权值.这样做是有一定原因的,首先,深层网络由许多非线性层堆叠而来 ...

  9. 梯度下降算法_梯度下降算法(Gradient Descent)的原理和实现步骤

    大部分的机器学习模型里有直接或者间接地使用了梯度下降的算法.虽然不同的梯度下降算法在具体的实现细节上会稍有不同,但是主要的思想是大致一样的.梯度下降并不会涉及到太多太复杂的数学知识,只要稍微了解过微积 ...

最新文章

  1. datetime 和 smalldatetime
  2. python内置函数源代码_4.内置函数源码总结
  3. study note9
  4. ansible结合playbook批量部署war包项目上线
  5. php解析api xml并输出到html页面,怎样操作JS读取xml内容并输出到div内
  6. redis之proxy集群之twemproxy
  7. Delphi XE7 用indy开发微信公众平台(3)- 验证消息真实性
  8. graphics | 基础绘图系统的拼图方法之三:使用mfrow、mfcol参数和layout函数
  9. JShielder:一款自动化Linux服务器安全增强工具
  10. 字符串匹配之PabinKarp(模式匹配)
  11. 读写锁就是恶霸和良民一起桑拿
  12. matlab粒子群运动模拟伪代码,基本粒子群优化算法(PSO)的matlab实现
  13. 三天两夜,1M图片优化到100kb/肝都熬爆了
  14. 翻译2Momentum, business cycle, and time varying expected returns(后附读后感)(图表上传不了)
  15. 如何将诸如Acrobat Reader DC等默认安装在C盘的软件,安装在非系统盘?
  16. cf 667div3
  17. 芯片验证漫游指南 pdf_更好地认识PDF 文件
  18. 数组如何定义和初始化?
  19. 安徽大学计算机数据库基础知识,ahu: 安徽大学计算机专业【初试真题】 - 计算机专业基础(数据结构,操作系统)【复试真题】 - 计算机专业综合(计算机组成原理,数据库原理)...
  20. 爬虫奇遇记——爬不到想要的内容

热门文章

  1. UITableView 点击选中改变字体颜色并记录
  2. 高级特性(6)- 高级Swing
  3. MySQL limit 优化,百万至千万级快速分页:复合索引
  4. Silverlight开发历程—模糊特效与投影特效
  5. 使用U盘安装操作系统
  6. 6月第2周回顾:雅虎收购案谈崩 中国***成焦点
  7. 深度linux怎么备份系统下载,在Deepin 20下安装和配置timeshift并用它自动备份系统...
  8. 在java面向对象编程中_谈一谈你对封装_继承_多态概念的理解_Java新职篇:面向对象编程的3个原则是什么?...
  9. php odbc连接数据库命名实例,一个用mysql_odbc和php写的serach数据库程序_php实例
  10. mysql 复制 二进制文件命令_Mysql中复制详细解析