A neural network is many simple neurons stacked in layers. Each figure here runs a real network in your browser, built from scratch for the book, so you can see what more neurons, a different activation or a different optimizer actually change.
Shaded areas are classified as the filled kind. The network is 2 inputs → hidden neurons → 2 outputs. Try it: with ReLU on, raise the hidden neurons from 1 to 3 and watch the boundary fold. Then switch the activation off and move the slider again.
Figure
Four activation functions
The function
Its slope
Input
1.5
Output
1.500
Slope here
1.000
Note
The default for hidden layers.
The solid line is the function. The dashed line is its slope, which is what training uses. Try it: switch between the four and compare their slopes far from zero. Then look at the step function's slope.
Figure
The same network, five optimizers
Class 1, and where the network predicts it
Class 2, and where the network predicts it
Class 3, and where the network predicts it
Steps
0
Loss
1.173
Right on the 300 shown
32%
Right on 300 new points
34%
A small network learns to tell three spiral arms apart. Each run starts from identical weights. Choosing an optimizer resets the network. Try it: train with plain SGD for a few hundred steps and note how slowly the loss falls. Then choose Adam and train again.