Gradient descent: Difference between revisions
Data-point index i to k in prose, since i is now the optimisation step (via update-page on MediaWiki MCP Server) |
Restore the convergence index n in Goal: n means index at convergence, i is the iteration index (via update-page on MediaWiki MCP Server) |
||
| Line 12: | Line 12: | ||
Let $f(\vec x)$ be a [[differentiable function]]. | Let $f(\vec x)$ be a [[differentiable function]]. | ||
Gradient descent finds a value of $\vec | Gradient descent finds a value of $\vec x_n$ s.t $f_\text{min}=f(\vec x_n)$. | ||
=== Process === | === Process === | ||
Revision as of 13:39, 11 November 2026
Gradient descent is an iterative optimisation algorithm used to find the local minimum of a differentiable function.
It is the fundamental algorithm used to train many machine learning models, including artificial neural network (ANN).
Mathematical definition
Goal
Let $f(\vec x)$ be a differentiable function.
Gradient descent finds a value of $\vec x_n$ s.t $f_\text{min}=f(\vec x_n)$.
Process
Start with a reasonable guess $\vec x_0$ and iteratively updates according to the rule:
$$\vec x_{i+1} = \vec x_i - \eta \nabla f(\vec x_i)$$
until $\nabla f(\vec x_n) \to \vec 0$, then $\vec x=\vec x_n$ is a local minimum of $f$.
| $\vec{x}_0$ | Initial guess |
| $\eta\in(0,1)$ | Learning rate |
| $\nabla f(\vec{x}_i)$ | Gradient of $f$ at $\vec{x}_i$ |
| $i$ | Iteration index |
| $n$ | Index at convergence |
Why $-\nabla f$: The gradient $\nabla f$ points in the direction of the steepest ascent. To minimise the function, move in the opposite direction for the steepest descent.
Gradient descent is most useful for complex functions. For simple functions setting directly $\eta \nabla f(\vec x)=0$ and solve for $\vec x$ finds local extremum candidates. Evaluate $f$ at all candidate points and take the lowest value to obtain the global minimum of $f$, which is simpler and more accurate.
Aggregation
If
$$ f=\sum_{k \in I} f_k $$
then
$$ \vec x_{i+1} = \vec x_i - \sum_{k \in I} \eta \nabla f_k(\vec x_i) $$
Mathematical example
Applications
Training artificial neural network (ANN)

Let $\mathbf{W}$ be the weight&biases matrix of an artificial neural network (ANN), $S$ be the training data set., $C_k(\mathbf{W})$ its cost function for training data point $s_k \in S$, which measures the error between the model's predictions and the true values in the training set (e.g., sum of squared errors (SSE)).
Then training is iteration with step $$ \mathbf{W}_{i+1} = \mathbf{W}_i - \sum_{s_k \in S} \eta \nabla C_k(\mathbf{W}_i). $$
