当前位置:网站首页>李宏毅机器学习2022.7.15--梯度下降
李宏毅机器学习2022.7.15--梯度下降
2022-07-17 05:11:00 【ww9878】
梯度下降的介绍
在解决最优化的问题中
我们需要找到最小一组的θ,让损失函数越小越好。
首先任意选取w0和b0的值,对于w1和b1进行update:
η为学习率,人工设值。重复上面的步骤不停的更新wi和bi直到无变化。在update wi和bi的过程即为梯度下降。
偏微分部分为梯度部分
学习率η
学习率η的调整要适当刚好,过大容易卡在某一位置。过小则决定移动距离较小,结果出现的较慢。如图:
通常一开始的离距离最低点较大,可以选择η值较大,而随着移动距离最低点越来越近则可以适当的调低η的值。不同的参数需要不同的学习率。
Adagrad 算法
每个参数的学习率都把它除上之前微分的均方根,σ^t:之前参数的所有微分的均方根,对于每个参数都是不一样的。
g^ t 梯度越大。移动的距离越大,而σ^t 梯度越大,步子越小。二者之间有所矛盾。考虑跨参数的问题,所以最好的步伐应该是:一次微分/二次微分。和一次微分成正比,和二次微分成反比,二次微分较大,参数update比较大。考虑二次微分才能真实反映最低点的距离。
随机梯度下降
随机梯度下降法比之前的梯度下降更快,任意或按顺序选取一个X^n,计算损失函数后就update梯度。
一般的梯度下降一步可能包含多个例子,而随机梯度下降已经走了很多步。
特征缩放
将其输入特征范围缩放,使不同的特征范围相同。
当xi的输入值较大wi同样变化时,对输出值影响较大。从图中可以看出x2对损失函数的影响比较大,则w2处周围比较陡峭。
缩放方法

在第i个维度中计算器平均值mi,还有其标准差σi,然后用第r个例子中的第i个输入,减掉平均数 mi,然后除以标准差 σi,得到的结果是所有的维数都是 0,所有的方差都是1。
梯度下降数学理论基础
这里有一些地方还是不太明白,暂时备注
泰勒展开式
若 h(x)在x=x0点的某个领域内有无限阶导数(即无限可微分,infinitely differentiable),那么在此领域内有:

当x很接近x0时,有 h(x)≈h(x0)+h′(x0)(x−x0) 上式就是函数h(x)在x=x0点附近关于x的幂函数展开式,也叫泰勒展开式。
多元泰勒展开式


基于泰勒展开式,在(a,b)点的红色圆圈范围内,可以将损失函数用泰勒展开式进行简化:

从而得到
让损失函数最小 取(u,v)相反的方向
u和v带入:
泰勒展开式推到过程

梯度下降的限制
在梯度下降的过程中,由于偏微分等于0,容易停在非极小值的点。
边栏推荐
- Pointnet++ code explanation (VI): pointnetsetabstraction layer
- Edge AI edge Intelligence: Communication EF "city edge ai: algorithms and systems (to be continued)
- Spark源码-Core RDD部分代码解析(一)
- seq2seq (中英对照翻译)Attention
- 5种2D Attention整理(Non-Local、Criss-Cross、SE、CBAM、Dual-Attention)
- Seq2seq (Chinese English translation) attention
- 深度学习中常用的激活函数
- SnackBar source code analysis and packaging
- Run yolov5 process record based on mindspire
- About terminating tasks in thread pool
猜你喜欢

CV-Model【2】:Alexnet

VS 中 error C4996: ‘scanf‘: This function or variable may be unsafe. 的解决方法。

Pointnet++ code explanation (I): farthest_ point_ Sample function

C language implementation of iteration and binary search

Deep clustering correlation (three articles)

PyTorch学习笔记【1】:使用张量表征真实数据

Seq2seq (Chinese English translation) attention

CUDA编程-04:CUDA内存模型

自監督學習概述
![[first launch in the whole network] will an abnormal main thread cause the JVM to exit?](/img/ae/5df25d64c2f29292bbfb21f696bbb0.png)
[first launch in the whole network] will an abnormal main thread cause the JVM to exit?
随机推荐
VS 中 error C4996: ‘scanf‘: This function or variable may be unsafe. 的解决方法。
如何优化深度学习模型以提升推理速度
简单Web服务器程序设计与实现
Application and principle of throttle/debounce
运行基于MindSpore的yolov5流程记录
模型时间复杂度和空间复杂度
BeatBox
Pytorch learning notes [5]: generalization using convolution
Pointnet++ code details (II): Square_ Distance function
BEVFormer: Learning Bird’s-Eye-View Representation from Multi-Camera Images via Spatiotemporal Trans
[first launch in the whole network] will an abnormal main thread cause the JVM to exit?
Pointnet++ code explanation (VII): pointnetsetabstractionmsg layer
如何用TensorRT部署YOLOv6
CV learning notes [2]: convolution and conv2d
SnackBar source code analysis and packaging
【语音识别】MFCC特征提取
The OCR tag of the pad is converted to TXT format
Regular replace group (n) content
Could not locate zlibwapi. dll. Please make sure it is in your library path
对Crowdhuman数据集处理,根据生成的train.txt分离数据集