提交 b3138a83 编写于 作者: A Aston Zhang

--- rather than --

上级 0520ad4a
......@@ -3,7 +3,7 @@
TODO(@astonzhang)
## 微积分
## 导数和梯度
假设目标函数$f: \mathbb{R}^d \rightarrow \mathbb{R}$的输入是一个多维向量$\mathbf{x} = [x_1, x_2, \ldots, x_d]^\top$。目标函数$f(\mathbf{x})$有关$\mathbf{x}$的梯度是一个由偏导数组成的向量:
......
# 梯度下降和随机梯度下降 --- 使用Gluon
# 梯度下降和随机梯度下降——使用`Gluon`
`Gluon`里,使用小批量随机梯度下降很容易。我们无需重新实现该算法。特别地,当批量大小等于训练集大小时,该算法即为梯度下降;批量大小为1即为随机梯度下降。
......@@ -115,8 +115,8 @@ optimize(batch_size=10, trainer=trainer, num_epochs=3, decay_epoch=2,
```{.python .input n=7}
net.collect_params().initialize(mx.init.Normal(sigma=1), force_reinit=True)
trainer = gluon.Trainer(net.collect_params(), 'sgd', {'learning_rate': 0.002})
utils.optimize(batch_size=10, trainer=trainer, num_epochs=3, decay_epoch=2,
log_interval=10, X=X, y=y, net=net)
optimize(batch_size=10, trainer=trainer, num_epochs=3, decay_epoch=2,
log_interval=10, X=X, y=y, net=net)
```
## 结论
......
# 梯度下降和随机梯度下降(从0开始)
# 梯度下降和随机梯度下降——从0开始
在之前的章节里,我们通过损失函数$\ell$中参数的梯度$\nabla_{\theta}\ell$来决定如何更新模型$\theta$的参数。我们也提到过学习率$\eta$,并给出了使用梯度下降算法更新模型参数的步骤:
在之前的章节里,我们通过损失函数$\ell$中参数的梯度$\nabla_{\theta}\ell$来决定如何更新模型的参数$\theta$。我们也提到过学习率$\eta$,并给出了使用梯度下降算法更新模型参数的步骤:
$$\theta_{t} \gets \theta_{t-1} - \eta \nabla_{\theta}\mathcal{L}_{t-1}$$
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册