Stochastic 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) |
Normalise the SGD step by the sample size, matching the eta/m form used in Backpropagation (via update-page on MediaWiki MCP Server) |
||
| Line 17: | Line 17: | ||
$$ | $$ | ||
\vec x_{i+1} = \vec x_i - \sum_{k \in I_1 \subset I} | \vec x_{i+1} = \vec x_i - \frac{\eta}{|I_1|}\sum_{k \in I_1 \subset I} \nabla f_k(\vec x_i), | ||
$$ | $$ | ||
where $I_1 \subset I$ is the sample examined at iteration $i$. The step uses the average sampled gradient rather than its sum, so that $\eta$ keeps the same meaning whatever the sample size. | |||
== Validity == | == Validity == | ||
Revision as of 13:45, 11 November 2026
Stochastic gradient descent (SGD) is a variant of gradient descent that optimises computation for aggregated differentiable objective function by estimating the gradient from a random sample of the data at each iteration.
It is the standard algorithm used to train artificial neural network (ANN) models on large datasets.
Mathematical definition
Let
$$ f=\sum_{k \in I} f_k $$
then
$$ \vec x_{i+1} = \vec x_i - \frac{\eta}{|I_1|}\sum_{k \in I_1 \subset I} \nabla f_k(\vec x_i), $$
where $I_1 \subset I$ is the sample examined at iteration $i$. The step uses the average sampled gradient rather than its sum, so that $\eta$ keeps the same meaning whatever the sample size.
Validity

The expected value of the sample gradient equals the true gradient, i.e.,
$$ \mathbb{E}[\sum_{k \in I_1 \subset I} \eta \nabla f_k(\vec x_i)] = \nabla f(\vec x_i). $$
Therefore, the stochastic gradient is an unbiased estimator of the true gradient.
Advantage
In training artificial neural network (ANN)
Training large ANNs require large datasets with millions of datapoints and thousands of iterations. Calculating the true gradient requires evaluating $f_k$ for each datapoint, which is computationally prohibitive. Stochastic gradient descent significantly reduces computation burden without sacrificing accuracy.