liveBook · Manning

Stochastic gradient descent

As explained in Grokking Machine Learning

A gradient-descent variant that updates model parameters using one training data point at a time.

How can a model improve without measuring every training example at once? Stochastic gradient descent answers by updating the model with one point per iteration, nudging its parameters to reduce that point’s error. It contrasts with mini-batch gradient descent, which uses several points, and batch gradient descent, which uses the entire dataset. section 3.4

The basic pattern is:

A line that learns from individual points

Imagine a line separating cats from dogs. A correctly classified point leaves the line where it is; a misclassified point moves the line slightly toward that point. Repeating this with randomly selected points can produce a separator that classifies most examples correctly. For regression, the same point-by-point idea moves a line toward individual data points while reducing error. section 5.3 section 3.4

Figure 5.23 If we apply the perceptron trick many times, each time picking a random point, we can imagine that we’ll obtain a classifier that classifies most points correctly.

Visualizes repeated point-by-point updates and the gradual improvement of a classifier. section 5.3

How Grokking Machine Learning covers it

How deep it goes
Defines point-wise updates and contrasts batch sizes, while deferring full mathematical details to gradient-descent appendices.
Examples
Uses a regression line, individual data points, and a perceptron line responding to correctly or incorrectly classified points.
What you can do after
Apply it conceptually by performing repeated single-point updates that reduce regression error or improve classification.
How it connects
Connects gradient descent with error functions, linear regression, perceptron algorithms, mini-batch gradient descent, and batch gradient descent.

Also explained in

Compare how 12 books explain stochastic gradient descent →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Machine Learning. The section links point to the parts of the book it draws on.