这是用户在 2024-5-25 16:37 为 https://edstem.org/au/courses/14775/lessons/47636/slides/324296 保存的双语快照页面,由 沉浸式翻译 提供双语支持。了解如何保存?

Summary 摘要

Gradient descent for linear regression
线性回归的梯度下降

Gradient descent can be used to solve many things. Today we used it to build a linear regression model.
梯度下降法可以用来解决很多问题。今天,我们用它来建立一个线性回归模型。

Our objective function is:
我们的目标函数是

f(β0,β1)=12i=1N(β0+β1xiyi)2f\big(\beta_0, \beta_1\big)=\frac{1}{2}\sum_{i=1}^N(\beta_0+\beta_1x_i-y_i)^2

Our gradients are: 我们的梯度是

β0f=i=1N(β0+β1xiyi)β1f=i=1Nxi(β0+β1xiyi)\nabla _{\beta_0} f=\sum_{i=1}^N(\beta_0+\beta_1x_i-y_i)\hspace{1.5cm}\nabla _{\beta_1} f =\sum_{i=1}^Nx_i(\beta_0+\beta_1x_i-y_i)

Hence, our final update equations for β0\beta_0 and β1\beta_1 are:
因此, β0\beta_0β1\beta_1 的最终更新方程为

β0i+1=β0iα0β0fβ1i+1=β1iα1β1f\beta_0^{i+1}=\beta_0^i-\alpha_0\nabla_{\beta_0}f\hspace{3cm}\beta_1^{i+1}=\beta_1^i-\alpha_1\nabla_{\beta_1}f

Loss curves 损耗曲线

Loss curves are used to observe a model's training process. In general, you want to see that at each iteration the error is reducing.
损失曲线用于观察模型的训练过程。一般来说,您希望看到每次迭代时误差都在减少。

Here are some examples of loss curves that you might see.
下面是一些您可能会看到的损失曲线示例。

Mini-batch gradient descent
小批量梯度下降

Mini-batch gradient descent is a variant of gradient descent where at each iteration, the gradient is calculated for only a subset of the full training data.
迷你批量梯度下降法是梯度下降法的一种变体,每次迭代时,只对全部训练数据的一个子集计算梯度。

Stochastic gradient descent is a special case of mini-batch gradient descent where the batch size is 1.
随机梯度下降法是迷你批次梯度下降法的一种特例,其批次大小为 1。