liveBook · Manning

Learning rate

As explained in Grokking Machine Learning

A learning rate is a small positive training parameter that controls the size of parameter updates made during model optimization.

When a model moves its line toward a data point, should it jump directly there or take careful steps? A learning rate answers that question. It is a small positive number chosen before training that limits how much the model changes at each update. In linear regression, it scales the correction applied to the line’s y-intercept and slope, helping the line move gradually toward the data. section 3.3

Figure 3.6 An illustration of the linear regression algorithm. We start at the top left with a random line and end in the bottom left with a line that fits the dataset well. At each stage, two things happen: (1) we pick a random point, and (2) the point asks the line to move closer to it. After many iterations, the line will be in a good position. This figure has only three iterations for illustrative purposes, but in real life, many more iterations are needed.

Follow the line’s repeated adjustments from a random starting position toward a better fit; each update represents a small move influenced by the learning rate. section 3.3

The same idea appears in two update patterns:

  • Linear regression multiplies the prediction error by the learning rate before adjusting the base price, and also multiplies the error by the number of rooms when adjusting the price-per-room slope. section 3.3
  • Gradient boosting multiplies each new tree’s prediction by the learning rate before adding it to the combined prediction, so successive trees contribute partial corrections. section 12.4

Two concrete settings

A linear regression routine can receive learning_rate=0.01 while repeatedly selecting training examples and applying the square trick. A gradient boosting regressor can use learning_rate=0.8 with four trees of maximum depth two; the second tree’s prediction is multiplied by 0.8 before joining the first tree’s prediction. section 3.3 section 12.4

How Grokking Machine Learning covers it

How deep it goes
Defines the update-scaling role and demonstrates it in formulas and code, without deriving a general optimization theory.
Examples
Uses house-price line fitting with 0.01 and app-engagement gradient boosting with 0.8.
What you can do after
Apply it via Python linear-regression and Scikit-Learn gradient-boosting implementations.
How it connects
Connects parameter updates, linear regression, gradient boosting, decision trees, prediction errors, and residuals.

Also explained in

Compare how 16 books explain learning rate →

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.