What you set, and what the model learns
w and b are parameters. Training finds them. A hyperparameter is a setting you choose before training starts, and the model never changes it. Linear regression has three that matter: the learning rate, the batch size and the number of epochs.
Learning rate
Every step moves a parameter by the gradient times the learning rate. With a gradient of 2.5 and a rate of 0.01, w changes by 0.025. Too small and training crawls. Too big and the steps jump over the bottom of the loss, so it bounces around or grows. A good rate drops the loss steeply at first and then flattens out. There is no rate that suits every problem. You try a few.
Batch size
The batch size is how many teams the model looks at before each step. So far every step used the whole table, a full batch. That is fine for 20 teams and hopeless for 20 million rows. Two cheaper ways:
- Stochastic gradient descent (SGD) uses one random team per step. Very cheap, very noisy.
- Mini-batch SGD averages the gradient over a few random teams, more than one and fewer than all. This is what most training uses.
Pick a batch size on the board and run 10 steps a few times. At 1 the loss curve shakes, because one team is a poor guide to the whole table. At 5 it shakes less. That noise is not always bad, as the chapter on neural networks will show.